second line for a string

  • Thread starter Thread starter Ginni
  • Start date Start date
G

Ginni

Hi,
I am tryng to set a string equal to a select statement.
The statement is too long for one line. Isn't there a way
I can tell it that the string contunes onto the next line??
Thanks for any suggestions!
Ginni
 
If you have a super long string you can split it up a
couple of ways to fit in your screen.
You can wrap:
strSQL = "String " & _
"goes " & _
"here."
....or concatenate:
strSQL = "String "
strSQL = strSQL & "goes "
strSQL = strSQL & "here."

-Cameron Sutherland
 
I am tryng to set a string equal to a select statement.
The statement is too long for one line. Isn't there a way
I can tell it that the string contunes onto the next line??

I built an all purpose SQLBuild function, which I call like this:

strSQL = ";"
BuildSQL "SELECT ALL This,"
BuildSQL " That,"
BuildSQL " TheOther * 2 AS TwiceOther"
BuildSQL "FROM SomeTable"
BuildSQL "WHERE Filter LIKE " & Quoted(strSunSource)
BuildSQL "ORDER BY SortingColumn ASC"
BuildSQL strSQL

so that (a) the code is easier to read; and (b) the SQL has convenient
vbCrLf's stuck into it, so it's easier to read as well.

B Wishes


Tim F
 
Back
Top