Connecting Tech Pros Worldwide Forums | Help | Site Map

Rules for multiline SQL statements

carmela_wong@hotmail.com
Guest
 
Posts: n/a
#1: May 17 '06
Can someone enlighten me on what the rules are for writing multiline
SQL statements in Access. Something regarding the numerous double
quotation marks and and underscores I see in multiline SQL code.

Thanks a lot for any help in advance.


fredg
Guest
 
Posts: n/a
#2: May 17 '06

re: Rules for multiline SQL statements


On 17 May 2006 11:03:49 -0700, carmela_wong@hotmail.com wrote:
[color=blue]
> Can someone enlighten me on what the rules are for writing multiline
> SQL statements in Access. Something regarding the numerous double
> quotation marks and and underscores I see in multiline SQL code.
>
> Thanks a lot for any help in advance.[/color]

An example would have been nice here, as there are times when the use
of double quotes has nothing to do with the fact that the SQL is
multi-line. Let's us answer your question, not the question we think
you are asking.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
carmela_wong@hotmail.com
Guest
 
Posts: n/a
#3: May 17 '06

re: Rules for multiline SQL statements


I am getting confused between the use of different characters to
separate portions of a multiline SQL statement from one another and
characters used to enable strings to span multiple lines. Which of the
characters " or _ or & are used for what?

EXAMPLE OF TYPE 1: Example of multiline SQL:

strSqlPart1 = "SELECT tblOUMaster.[Serial Number],
tblOUMaster.EntryDate " & _
"FROM tblOUMaster WHERE (((tblOUMaster.[Serial Number])=" & """"

strSqlPart2 = """) AND ((tblOUMaster.EntryDate) Is Not Null));"

strSqlAll = strSqlPart1 & mySerialNumber & strSqlPart2
Need to select Serial Number and Entry Date from a table called
tblOUMaster where Serial Number is equal to mySerialNumber and Entry
Date is not null.

EXAMPLE OF TYPE 2: Example of string spanning multiple lines:

strMessage = "Enter the Date of Departure to be updated for Customer
Number " & _
Me.Customer_Number.Value & "."

The string variable strMessage will be used in a message box as
follows:

DateofDeparture = InputBox(strMessage, "Departure Date Entry
MessageBox")

carmela_wong@hotmail.com
Guest
 
Posts: n/a
#4: May 17 '06

re: Rules for multiline SQL statements


Sorry about the mental block I had. I figured it out. Thanks for
replying Fred.

Closed Thread


Similar Microsoft Access / VBA bytes