Can't run a query anymore

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

Access 2000. I have started getting a 'Can not perform this action at this
time' error on the line;

DoCmd.OpenQuery "My Query"

This app is running on a windows network and this particular code has been
running fine on the same network for years. A few years back this problem
came on the same network on another DoCmd.OpenQuery at a different location
in the same app. The solution I used was to turn the query into a string and
run using CurrentDB.execute QuerySt. Ideally I would like to avoid this. Has
any one come across this problem and know the fix?

Thanks

Regards
 
I don't know why a previously working query has sudenly stoped working, but
you haven't indicated what's changed on the target computer. If you believe
nothing's changed, then it's likely that a Windows Update is the culprit.

You don't need to turn the query into a VBA string. You can still use
db.Execute "My Query", but becaue of the massive performance hit incurred
using the CurrentDb function, you should limit its use. Perhaps either
create an object reference using Set db = CurrentDb (where multiple queries
are being executed), or DBEngine(0)(0) otherwise.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
There is, of course, a significant difference between OpenQuery and Execute.
Execute can only be used with Action queries (UPDATE, INSERT INTO, DELETE).
OpenQuery can be used with Select queries (and, in my opinion, shouldn't be
used with Action queries).
 
Hi Doug

This one is an action query.

Thanks all. I will use execute and see if it works at client's.

Regards
 
Back
Top