I have an Update action query that works manually. I can view it
correctly and then click on Run (!) and it works. However, when I
try to run it in vba with the DoCmd.OpenQuery "queryname", it does
not work.
Any suggestions appreciated.
john134
I have an Update action query that works manually. I can view it
correctly and then click on Run (!) and it works. However, when I
try to run it in vba with the DoCmd.OpenQuery "queryname", it does
not work.
Any suggestions appreciated.
john134
I should have mentioned that this is in Acess 2007.
john134
What does "it does not work" mean? Errors?? Messages??? How do you know "it doesn't work"?
That is like saying "My car does not work. What is wrong with it?" More details please.......
And what code, exactly, are you using?
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007
This is not my area of expertise, but the OpenDataMode argument accepts no 'Update' parameter when using DoCmd.OpenQuery...in fact I'm pretty sure you can do no Action Query from Access, in this manner. I'm pretty sure you need to use something along the lines of
DoCmd.RunSQL "UPDATE..."
or, preferably,
CurrentDb.Execute " UPDATE...", dbFailOnError
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007
I don't 'run' query objects, I use VBA as shown by Linq.
However, just did a test. OpenQuery does run the saved query object and records are updated.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I am updating a record from Table B to Table A. After I run the query manually
I look in Table A and find that the update occurred. When I ran it with vba code the
record in Table A was not updated.
But, the problem has been solved.
The record in Table B was located in a subform. I had intitated the event on a control in
that subform and it didn't work. However, when I initiated the query event on the subform's
On Exit, the update query worked.
john134