Line return from string to Field

pekajo

Registered User.
Local time
Tomorrow, 03:10
Joined
Jul 25, 2011
Messages
136
Hi,
It's me again.
I need to add a line feed in a string and write to a field. It works if I use msgbox but not when I write to the field.
I have tried all the normal chr(10) and chr(13) and both together.

I have the following code:
If IsNull(Me.D1AM) Then

Me.D1AM = DLookup("[Given]", "Volunteers", "[ID] = " & Me.Combo14)
Else
Me.D1AM = Me.D1AM & Chr(10) & DLookup("[Given]", "Volunteers", "[ID] = " & Me.Combo14)
End If
aa = Me.D1AM + vbNewLine & DLookup("[Given]", "Volunteers", "[ID] = " & Me.Combo14)

Thanks
Peter
 
can you try using vbCrLf instead of vbNewLine:



aa = Me.D1AM + vbCrLf & DLookup("[Given]", "Volunteers", "[ID] = " & Me.Combo14)
 
I use vbCrLf or vbNewLine with the & operator ...not the + operator
 
Not sure, but it all depends on the receiving field data-type.

aa = Me.D1AM + vbNewLine & DLookup("[Given]", "Volunteers", "[ID] = " & Me.Combo14)

This seems to be passing a STRING value.

I'd use:

aa = Me.D1AM & vbCRLF & "'" & DLookup("[Given]", "Volunteers", "[ID] = " & Me.Combo14) & "'"

Surrounding the whole, passed value in quotes.

Try it.

ATB,

Darrylle
 
As a side note, if you ever need to use chr for this, it has to be both chr(13) and chr(10) and in that order.
 

Users who are viewing this thread

Back
Top Bottom