Continue Code to next line

K

Karen53

Hi,

How do I continue a line of Visual Basic code to the next line. I thought
placing an underscore at the end of the line did that but it is not working.
What am I missing?

DoCmd.ApplyFilter , "Charlie = 0 And George = 0 And Harry = 0_
And Janice = 0 And Cathy = 0 "

Thanks
 
R

RuralGuy

Hi,

How do I continue a line of Visual Basic code to the next line. I
thought placing an underscore at the end of the line did that but it
is not working. What am I missing?

DoCmd.ApplyFilter , "Charlie = 0 And George = 0 And Harry = 0_
And Janice = 0 And Cathy = 0 "

Thanks

Hi Karen,

If you want to continue a String then you need to close the String.
Like so:

DoCmd.ApplyFilter , "Charlie = 0 And George = 0 And Harry = 0 " & _
"And Janice = 0 And Cathy = 0 "

The continuation is a space and an underscore

HTH
 
G

Graham Mandeno

Karen

I missed the fact that you are in the middle of a string. You need to
terminate the string and use the & operator to concatenate it to the next
portion starting on the following line:

DoCmd.ApplyFilter , "Charlie = 0 And George = 0 And Harry = 0 " _
& "And Janice = 0 And Cathy = 0 "

Note that you still need the space before the underscore.

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Graham Mandeno said:
Hi Karen

You need a space before the underscore.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Karen53 said:
Hi,

How do I continue a line of Visual Basic code to the next line. I
thought
placing an underscore at the end of the line did that but it is not
working.
What am I missing?

DoCmd.ApplyFilter , "Charlie = 0 And George = 0 And Harry = 0_
And Janice = 0 And Cathy = 0 "

Thanks
 
Top