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

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.
karnovskAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

grumpy147Commented:
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
Éric MoreauSenior .Net ConsultantCommented:
adCmdTable and Select statement are not working together!

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.