long query

  • Thread starter B B via AccessMonster.com
  • 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.
 
A

Andi Mayer

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:"
 
K

Kevin K. Sullivan

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
 

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