Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2005

Tip: Looking for answers? Try searching our database.

String spanning multiple lines

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brian - 24 Sep 2005 02:39 GMT
I know this is probably a dumb question with a simple answer, but how do I
get VBA to recognize a long string (over the 1024-character limit for a line
in VBA) as a single string (e.g. when concatenating a long SQL statement).
Brian - 24 Sep 2005 02:50 GMT
Never mind. I knew it had to do with the underscore and ampersand. I just
didn't get the right combination of the quotes and the space before the
underscore with the ampersand and qutoes on the next line.

ABC = "BlahBlahBlah" _
& "BlahBlahBlah" _
& "ad infinitum"

> I know this is probably a dumb question with a simple answer, but how do I
> get VBA to recognize a long string (over the 1024-character limit for a line
> in VBA) as a single string (e.g. when concatenating a long SQL statement).
RuralGuy - 24 Sep 2005 03:19 GMT
MyString = ".........................................." & _
                 "------------------------------------------" & _

etc.

The concatenation sequence is a space, the "&" and then another space and the
underscore.

>I know this is probably a dumb question with a simple answer, but how do I
>get VBA to recognize a long string (over the 1024-character limit for a line
>in VBA) as a single string (e.g. when concatenating a long SQL statement).

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
David C. Holley - 24 Sep 2005 04:04 GMT
Use the line continuation characater which you probably want me to tell
you is the underscore as in ...

If a = 1 AND b = 1 AND c = 1 _
  AND BillGates = "IDIOT" Then

Another trick which I'm found of is to break up the SQL statement in to
lines using natural line break - end of a field, between keywords etc.
to make reading it easier as in

strSQL = "SELECT lngTransportId, lngOrgKey, lngDestKey, _
dteDate, dteTimeScheduled _
FROM tblTransports _
WHERE lngTransportId = 1505 AND lngOrgKey = 43 AND lngDestKey = 54 _
ORDER BY lngTransportID;"

> I know this is probably a dumb question with a simple answer, but how do I
> get VBA to recognize a long string (over the 1024-character limit for a line
> in VBA) as a single string (e.g. when concatenating a long SQL statement).
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.