Reputation: 27239
I have inherited an Access database that I am trying to untangle so I can get it to do its intended purpose. I seem to have hit a relatively simple snag, but I've never seen this issue before, so it's throwing me throw a loop.
There are several statements in the vain of:
DoCmd.OpenQuery ("myQueryName")
When I step through these in code, the code executes, but the action of the query (APPEND, UPDATE, etc) do not take place. When I run them manually, they do the necessary action.
Can anyone offer some insight, as this really seems to be the snag that is causing the database not to do its intended purpose accurately?
Two more bits of information that may be helpful. The build is Access 2003, but I am running in Access 2010 as a 2003 database file. Also, the original author, placed notes in the queries to not run them manually. I assume this is to help alert users not to mess with things (although, it was a poor job to block query's from being run manually!!!), but I thought perhaps there's something to this that may help trigger a solution.
Thanks a ton for any help!
Upvotes: 1
Views: 14735
Reputation: 27239
what do you know, I found my answer after I posted this question. And it's what I thought all along. DoCmd.OpenQuery
does not normally open a query, but not execute it. For action queries, you need db.Execute "myQueryName"
or an SQL statement with DoCmd.RunSQL
.
Upvotes: 3