long query

  • Thread starter Thread starter B B via AccessMonster.com
  • Start date Start date
B

B B via AccessMonster.com

I have a simple question,
I have a very long query, so that I cannot write it in one line in Visual Basic, I wonder how may I divide it into two or more lines.
 
I have a simple question,
I have a very long query, so that I cannot write it in one line in Visual Basic, I wonder how may I divide it into two or more lines.


use a blank and a _ at the ende of the line and a & at the beginning
of the new line like:

Answer= "use a blank and a _ at " _
&"the ende of the line and a & at the " _
&" beginning of the new line like:"
 
In addition to line continuation characters, consider storing SQL in a
string variable and concatenating it together. This allows you to print the
string in the debug window and see where errors are. You can also paste it
into the SQL view of a new query.

Dim strSQL as String
Dim db as DAO.Database

Set db = CurrentDb

strSQL = "SELECT blah blah blah"
strSQL = strSQL & " FROM blah blah blah"
strSQL = strSQL & " WHERE blah blah blah"

Debug.Print strSQL

db.Execute strSQL

Set db = Nothing

HTH,

Kevin
----- Original Message -----
From: "B B via AccessMonster.com" <[email protected]>
Newsgroups: microsoft.public.access.modulesdaovba
Sent: Wednesday, December 29, 2004 8:04 AM
Subject: long query
 
Back
Top