Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2002
    Location
    Hamilton,Ontario
    Posts
    132

    Red face Unanswered: problem in sql statment in access

    hi here is the sqlstmt im trying to run ...all column names are spelled correctly but access is giving me error that it doesnt exist.....
    here is the statement

    SQLSTmt = "SELECT * FROM [Sales Order LineItems] WHERE [Item Number] = '" & formname![Item Number] & "' AND [Sales Order Number]= """ & formname![Sales Order Number] = """ & And [Line Number]= """ & formname![Line Number] & """"""

    any help would be appreciated , thank You

  2. #2
    Join Date
    Nov 2002
    Location
    Ohio
    Posts
    90
    1. Try putting your query into a string variable before execution. When it stops, you can print the string variable in the debug window and you might see missing quotes, syntax errors or unexpected data in the search fields. This also allows you to replace the contents of the string and try querying again without stopping and restarting the program.

    2. Break the query down into smaller pieces until you get each one working and reassemble the working pieces.

    3. Verify the names, data formats and values available in your table. Your users might have been creative with their data.

    Good Luck
    Bruce Baasch

  3. #3
    Join Date
    Mar 2002
    Posts
    192
    It looks like you included an extra set of quotes in the line number criteria there.. I'd check that first.

  4. #4
    Join Date
    Sep 2002
    Location
    New york
    Posts
    4
    If I'm not mistaken it looks like instead of quotes you have ' in your statement just before and after & formname so it looks like '" instead of "

  5. #5
    Join Date
    Mar 2002
    Posts
    192
    He wants to do that. He's trying to pass a string value there. To pass a string value you have to enclose the string in quotes. To pass a Quote to the sql interpreter you have to double it up like that. Only thing is on the right side he doubled it up twice.

Posting Permissions

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