?
Solved

Run-time error -2147217900 (80040e14) "Syntax error in FROM clause"

Posted on 1999-11-13
2
Medium Priority
?
556 Views
Last Modified: 2013-12-25
Each time I try to create a recordset based on a query, I get the above error.  For example:

    strQuery = "SELECT Surname FROM [Indi]"
    rstPeople.Open strQuery, cnnFamily, adOpenKeyset, _
                    adLockOptimistic, adCmdTable

The only way which works is

    rstPeople.Open "Indi", cnnFamily, adOpenKeyset, _
                    adLockOptimistic, adCmdTable

Microsoft acknowledges that problem in http://support.microsoft.com/support/kb/articles/q181/4/89.asp, but says the following:


    CAUSE

    The table name is a SQL reserved word, such as "Orders."


    RESOLUTION

    Change the table name to a non-reserved word, such as "Orders" or place square brackets
    around the name as follows:

              "[Orders]"

As you see, I am using the brackets, but they don't help.

I am using VB 6 (SP3) with ADO 2.1.
0
Comment
Question by:karnovsk
2 Comments
 
LVL 1

Expert Comment

by:grumpy147
ID: 2205629
Hi,

two questions

1) what database are you using ?
2) why do you use the "adCmdTable" argument when you are issuing a "SELECT" statement ?  the "RecordSet.Open" method works because you are actually opeining a table !

0
 
LVL 71

Accepted Solution

by:
Éric Moreau earned 400 total points
ID: 2205818
adCmdTable and Select statement are not working together!

If you want to use a complete SQL statement you should use adCmdText.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

593 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question