dcsimg
Results 1 to 5 of 5

Thread: [RESOLVED] Syntax error in FROM clause

  1. #1

    Thread Starter
    Addicted Member girl81's Avatar
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    211

    Resolved [RESOLVED] Syntax error in FROM clause

    Hi all..i was wondering with this error message..
    "Syntax error in FROM clause. Run time error '-2147217900'

    This error happened for Update and Add process when i retrieved the Table PRODUCT from Access..there is no error message again when i change table name PRODUCT to PRODUCT1..

    Thanks in advance..

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    40,273

    Re: Syntax error in FROM clause

    Moved to Database Development forum - which is where SQL/database related questions belong

    It sounds like Product is a reserved word.. presumably because there is a function with the same name (so there is confusion in working out whether you meant the function, or the table)

    The ideal solution is what you have done... change the table name.

  3. #3

    Thread Starter
    Addicted Member girl81's Avatar
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    211

    Re: Syntax error in FROM clause

    Quote Originally Posted by si_the_geek
    Moved to Database Development forum - which is where SQL/database related questions belong

    It sounds like Product is a reserved word.. presumably because there is a function with the same name (so there is confusion in working out whether you meant the function, or the table)

    The ideal solution is what you have done... change the table name.
    Thanks a lot..

  4. #4
    New Member
    Join Date
    May 2008
    Posts
    8

    Re: [RESOLVED] Syntax error in FROM clause

    Having a problem with this myself. Here is a code snip:

    Code:
    ' ReQuery the Customer table with old customer Number
                
                SQL = "SELECT * FROM [CustomerInfo] WHERE CustomerNumber=" & UnitRecord.CustomerNumber
                
                Log "***** CREATED SQL STATEMENT *****", SQL
                
                'CMD.CommandText = "SELECT * FROM CustomerInfo WHERE CustomerNumber=" & CLng(UnitRecord.CustomerNumber)
                
                'Set rstCustomerInfo = CMD.Execute
                'Log "Issued SQL Command: " & CMD.CommandText, ""
                
                
                rstCustomerInfo.Open SQL, dbCustomer, , , adCmdTable                    ' Open Customer Recordset
    As you can see I have been trying several different things. Nothing seaming to work. If I use the CMD version I just get a blank recordset back. If I use the SQL statement in my Open method, get a "Syntax error in FROM clause"

    Here is the actual SQL Statement that is produced

    SELECT CustomerInfo FROM [CustomerInfo] WHERE CustomerNumber=10864

    Code is VB6.0
    Database is Access 2002
    Manually going into the database, there is infact a customer with CustomerNumber 10864 so Im stumped

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    40,273

    Re: [RESOLVED] Syntax error in FROM clause

    Please don't post questions to old threads in future - not only does it generate emails to people who have subscribed to it (which is not just those who have posted to it), most of whom cannot help you, but it also reduces the chances of people answering your question (partly due to annoyance, and partly due to them wasting time reading the old posts only to find they have been solved).


    The problem with your use of .Open is an obvious one, and you can find the answer in the article What do the parameters of the recordset.Open method mean? from our Database Development FAQs/Tutorials (at the top of this forum)

    Using the Command object is better, but you are avoiding its advantages. For an explanation of why you should be using parameters (and links to code examples), see the FAQ article Why should I use Parameters instead of putting values into my SQL string?

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width