Wrap a Line

D

DS

How do you wrap this line so that I don't have to have it on one line, I
need to break it into 2 lines.

Thanks
DS

Me.TxtCancel = DCount("Sent", "SalesDetails", "Sent = True And
SalesID=Forms!OrderScreen!SalesID")
 
T

tina

try

Me.TxtCancel = DCount("Sent", "SalesDetails", "Sent = True " _
& "And SalesID=Forms!OrderScreen!SalesID")

hth
 
D

DS

tina said:
try

Me.TxtCancel = DCount("Sent", "SalesDetails", "Sent = True " _
& "And SalesID=Forms!OrderScreen!SalesID")

hth
So this is like SQL in VBA but instead of " & _
its " _
Thanks
DS
 
T

tina

So this is like SQL in VBA but instead of " & _

in VBA, the & symbol is used to concatenate two strings (pretty much the
same as SQL, i'd say). if you take another look at the code i posted, the &
symbol is there on the second line, and its' function is to concatenate the
two strings of the DCount() function's criteria argument. the "space then
underscore" ( _) is a line break symbol. it tells the VBA compiler to treat
the following line of code as though it were on the same line, and that's
all it does. you can use it at a "natural break" in the code, such as

Me.TxtCancel = DCount("Sent", "SalesDetails", _
"Sent = True And SalesID=Forms!OrderScreen!SalesID")

where there's a comma between arguments in the function. or you can use it
to break up a long string into multiple lines - but in that case, you have
to enclose each line of the string in double quotes and concatenate the
resulting mutiple strings with the & symbol.

hth
 
D

DS

tina said:
in VBA, the & symbol is used to concatenate two strings (pretty much the
same as SQL, i'd say). if you take another look at the code i posted, the &
symbol is there on the second line, and its' function is to concatenate the
two strings of the DCount() function's criteria argument. the "space then
underscore" ( _) is a line break symbol. it tells the VBA compiler to treat
the following line of code as though it were on the same line, and that's
all it does. you can use it at a "natural break" in the code, such as

Me.TxtCancel = DCount("Sent", "SalesDetails", _
"Sent = True And SalesID=Forms!OrderScreen!SalesID")

where there's a comma between arguments in the function. or you can use it
to break up a long string into multiple lines - but in that case, you have
to enclose each line of the string in double quotes and concatenate the
resulting mutiple strings with the & symbol.

hth
Great Thanks! A Big Help!
DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top