Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I continue the code on the next line ? 1

Status
Not open for further replies.

Rmcta

Technical User
Nov 1, 2002
478
US
If I am writing code, example:
DoCmd.OpenReport stDocName, acViewPreview, , "Country='" & strVal & "' AND ([FromDate] etc...
and wish to use more than 1 line for clarity, how do I end the line to be able to continue on the next?
 
HI,

Just add an underscore "_" and continue.

example:

DoCmd.SendObject , , , strRecipient, _
, , "Message Subject", , True

HTH Have A Great Day!!!, [bigglasses]

Nathan
Senior Test Lead
 
Nathan,
I tried that but my code becomes red as soon as I do that??

Here is the code:

DoCmd.OpenReport stDocName, acViewPreview, , "Country='" & strVal & "' AND _
([FromDate] BETWEEN (#" & dteValFrom & "#) AND (#" & dteValTo & "#) OR _
ToDate BETWEEN (#" & dteValFrom & "#) AND (#" & dteValTo & "#))"

 
Hi,

You had a little more going on than I expected. :)

Try this and let me know.

DoCmd.OpenReport stDocName, acViewPreview, , "Country='" & strVal & "'" & _
"AND [FromDate] BETWEEN (#" & dteValFrom & "#) AND (#" & dteValTo & "#)" & _
"OR ToDate BETWEEN (#" & dteValFrom & "#) AND (#" & dteValTo & "#))" Have A Great Day!!!, [bigglasses]

Nathan
Senior Test Lead
 
I copied your code and pasted it over mine but again it becomes yellow. :(
 
Hi,

Hmmm....I do see a parenthese missing. Try this and let me know.

DoCmd.OpenReport stDocName, acViewPreview, , "Country='" & strVal & "'" & _
"AND ([FromDate] BETWEEN (#" & dteValFrom & "#) AND (#" & dteValTo & "#)" & _
"OR ToDate BETWEEN (#" & dteValFrom & "#) AND (#" & dteValTo & "#))" Have A Great Day!!!, [bigglasses]

Nathan
Senior Test Lead
 
How about actually USING the built in HELP? Many of the examples use line continuation and help actually cover the topic. It should be covered by any beginner's class on hte (programming) language!

MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Yes Nathan,
It works. GREAT! Thank you very much [2thumbsup]
 
glad i could help. :) Have A Great Day!!!, [bigglasses]

Nathan
Senior Test Lead
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top