Error #510, then error #1004

I have an application that works perfectly on hundreds of PCs running XP or Vista.  We installed on a client;s computer with Vista Business and Micrsoft Office 2007 installed.  Now, when my app gets to a point in the code where it creates a recordset (using DAO) it crashes,  First I get error #510, then click OK, then get error #1004.

The line of code is something like:
sql = "select * from table1 where id = 6"
set rs = db.openrecordset(sql,dbopendynaset)

The strange thing is, it seems that the where clause is what it doesn't like.  Without the where clause I don;t get an error.  For example, if I write:

set rs=db.openrecordset("table1",dbopenrecordset)

I don't get an error.

I've tried changing the DAO360.DLL file to different versions, but that doesn't seem to solve the problem.

Any ideas?
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.

I suspect there are more errors below the surface.  
Enable error trapping (On Error Resume Next), check for Err <> 0, and then look at the ERRORS collection.

Also, I suspect that you will need to prefix the data types of your database objects with "DAO."
Dim db As DAO.Database
Dim rs As DAO.Recordset
murray44Author Commented:
We have declared the variables as you suggest

If we put "on error resume next", it will skip over any errors which might occur!
it traps the errors, allowing you to delve deeper into the potential causes such as examining the ERRORS collection.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

murray44Author Commented:
Hmmm, sorry to sound dumb here, but I'm not that familiar with the .NET environment.  I;m more of a VB6 guy still, unfortunately.

But I did do a small program with VB.NET to try to reproduce the error.  So I could ty out your suggestion there, if I knew how to access this errors collection of which you speak.

I don;t know if I mentioned this, but this error is hard to recreate - it occurs only on a particular client's machine, who;s running Vista Business ed., with Office 2007 and a few other programs installed.

Thanks for your help on this
None of my comments relates to the VB.Net environment.  I'm strictly commenting in the VB/VBA perspective on this question.
murray44Author Commented:
I found a solution, thanks.

It appears the msjet40.dll file was out of sybch on the target machine.  I replaced it and registered it and that solved it.

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.