second line for a string

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
 
C

Cameron Sutherland

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
 
T

Tim Ferguson

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
 

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