Rules for multiline SQL statements

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • carmela_wong@hotmail.com

    #1

    Rules for multiline SQL statements

    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

    #2
    Re: Rules for multiline SQL statements

    On 17 May 2006 11:03:49 -0700, carmela_wong@ho tmail.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

    Comment

    • carmela_wong@hotmail.com

      #3
      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.Ent ryDate " & _
      "FROM tblOUMaster WHERE (((tblOUMaster.[Serial Number])=" & """"

      strSqlPart2 = """) AND ((tblOUMaster.E ntryDate) 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_Num ber.Value & "."

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

      DateofDeparture = InputBox(strMes sage, "Departure Date Entry
      MessageBox")

      Comment

      • carmela_wong@hotmail.com

        #4
        Re: Rules for multiline SQL statements

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

        Comment

        Working...