Results 1 to 7 of 7

Thread: Two Line SQL

  1. #1
    Join Date
    Nov 2005
    Posts
    49

    Unanswered: Two Line SQL

    I have a insert sql statement that takes up 2 lines in Visual Basic and I am using Microsoft Access....how do I run the sql query as 1 query instead of 2?

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Mind posting your code? Is it one query over two lines or two queries over two lines?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Nov 2005
    Posts
    49
    Its one query that takes up 2 lines of code (its a long insert query as theres lots of variables...

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Code:
     strSQL = "My First Line of Code" & _
    "My Second Line of code" & _
    "And so on"
    Or

    Code:
     strSQL = "My First Line of Code" 
    strSQL = strSQL & "My Second Line of code" 
    strSQL = strSQL & "And so on"
    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Nov 2005
    Posts
    49
    how would I execute the strSQL?

  6. #6
    Join Date
    Nov 2003
    Posts
    1,487
    DoCmd.RunSQL strSQL.
    Environment:
    Self Taught In ALL Environments.....And It Shows!


  7. #7
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Code:
     DoCmd.RunSQL strSQL
    Or (my preferred method)
    Code:
    CurrentDB.Execute strSQL dbFailOnError
    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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