DLL error message when trying to use openquery

A

Aaron

Hi,
I'm trying to get a form/a field in a form (I don't care which
and none of them work for the same reason) to run a query when it is
updated. I've been trying to use the DoCmd.OpenQuery command, which I
have used before with success. For some reason this time I am getting
an Error in opening DLL... Here is the code:

Private Sub FLIGHT_LINE_POSTS_TYPE_PERS_AfterUpdate()
DoCmd.OpenQuery "Update_Flightline_Staffing"
End Sub

The first line and last line, of course, are automatically generated
when I select the AfterUpdate Event and tell access I want to use the
code builder. The Query name is correct...I've checked it several
times. It's an update query...which works when opened manually.

The other strange thing about this error is that in the debugger, the
FIRST line is highlighted as having the error. But I didn't write the
first line! I can't even change it, it autocorrects...

Please help! Thanks!

-Aaron
 
K

Klatuu

The OpenQuery method is really intended for running select queries. For
action queries, you should either use docmd.RunSQL or my preferred way is to
use:
Currentdb.Execute "QueryName", dbFailOnError
It is much faster and you don't have to set and reset SetWarnings.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top