Continue Code to next line

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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,

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
 
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
 

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

Back
Top