Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2002
    Posts
    2

    Unanswered: run-time error 3131 "syntax error in FROM clause"

    I'm trying to perform queries via VB of an Access database that has table names that have spaces (example "SIGNAL LEVELS". I get a run-time error 3131 "syntax error in FROM clause".
    Any ideas on how to handle the table name. I don't want to rename the tables.

  2. #2
    Join Date
    Dec 2001
    Posts
    79
    Put brackets "[]" around the table names.

    Hope this helps,
    Peter De Baets
    Peter's Software - Microsoft Access Tools for Developers
    http://www.peterssoftware.com

  3. #3
    Join Date
    Mar 2002
    Location
    Gothenburg, Sweden
    Posts
    3

    Angry

    Hey!

    I got the same problem. I tried the brackets, not working =/

    This is my SQL statement:
    SELECT * FROM order WHERE order.orderno=" & Val(Text1.Text)

    Best wishes
    // David

  4. #4
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    Did this not work:

    "SELECT * FROM Order WHERE OrderNo=" & me![Text1]

  5. #5
    Join Date
    Mar 2002
    Location
    Gothenburg, Sweden
    Posts
    3
    Nope, I'm afraid not. Just tried it and I got.

    "Run-time error: 3131"

    "Syntax error in FROM clause"




    I'm using the "Microsoft DAO 3.6 Object Library" in VB6 and I'm trying to fetch data from an Access 2000 database.

    Cheers
    // David

  6. #6
    Join Date
    Jun 2003
    Location
    Southampton
    Posts
    1
    This may have come too late but I had the same problem and found the cure to be in the SELECT * part of the statement.

    My code was

    strJobPopTemp = strJobPop & " ORDER BY JobSheetID"

    Me.RecordSource = strJobPopTemp


    where strJobPop was from another module, a SELECT * FROM qryJob

    I had to change strJobPop to
    SELECT JobSheetID, JobName FROM qryJOb

    I hope this makes sense!!

    Steve.

  7. #7
    Join Date
    Mar 2002
    Location
    Gothenburg, Sweden
    Posts
    3

    Talking

    Thanx for your reply.
    However, I've solved it for quite some time ago. The problem was that ORDER is a registered command within SQL, so I can't have that as a table name. Silly me. I changed the name of the table to ORDERS and from then everything worked beautifully.

    Thanx again for your time.

    Best wishes
    // Dave

Posting Permissions

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