Results 1 to 9 of 9

Thread: easy one

  1. #1

    Thread Starter
    Lively Member nfo1212's Avatar
    Join Date
    Aug 2001
    Location
    Near Boston, U.S.A.
    Posts
    82

    easy one

    How do you write a sql statement on multiple lines? The _ continuer doesn't seem to work for them.

    Many Thanks

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    in what?

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Dim SQL As String

    SQL = "SELECT yada FROM yada "
    SQL = SQL & " WHERE yabba = 'dabba'
    SQL = SQL & " AND ......

    etc.

  4. #4
    Frenzied Member blindlizard's Avatar
    Join Date
    Feb 2001
    Location
    Austin, TX - United States of America
    Posts
    1,141
    sSQL = "Select *"
    ssql = ssql & " From Table"

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    I saw chrisjk comment after I posted mine.

    My suggestion implies the creation of a string which is executed in VB via the .Execute method of whatever type of environment you are using, i.e., ADO, DAO

  6. #6

    Thread Starter
    Lively Member nfo1212's Avatar
    Join Date
    Aug 2001
    Location
    Near Boston, U.S.A.
    Posts
    82
    That's what I needed to know. Thanks!

  7. #7
    Hyperactive Member
    Join Date
    May 2001
    Posts
    306
    VB Code:
    1. strSQL = "SELECT one, two, three " & _
    2.                "FROM table1 " & _
    3.                "WHERE one = 1"


    that'll do it

  8. #8
    Lively Member
    Join Date
    Jul 2000
    Posts
    94

    Wink Ampersand!

    Try this:

    sSQL = "SELECT * FROM " & _
    "TableName WHERE " & _
    "Blah blah blah!"

  9. #9

    Thread Starter
    Lively Member nfo1212's Avatar
    Join Date
    Aug 2001
    Location
    Near Boston, U.S.A.
    Posts
    82
    Oh, that's even better actually. Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width