Docmd.Openquery problems

Blastbeats

Registered User.
Local time
Today, 12:25
Joined
Feb 22, 2012
Messages
17
Im trying to implement a query that creates a table with existing filtered data when i click a button, the problem is that, whenever i do this access prompts some windows asking if i want to confirm the operation of inserting X rows, i wanted to know if theres any parameter or any method to do this without this kind of problem, thanks in advance
 
Howzit

Try turning the warnings off then back on again

Something like

Code:
docmd.setwarnings False
' your code here
docmd.setwarnings True
 
thanks a million man, really appreciate the help, it worked
 
The weakness of turning off warnings is that any failures in the query will be quietly ignored.

It is generally better to use CurrentDb.Execute to run the query. It doesn't have warnings. However you can (and should) include dbFailOnError as the second argument and it will throw an error if there is a problem.

The drawback of Execute is that it only understands tables and queries. References to forms cannot be processed so these values must be concatenated into the SQL string.
 
yeah come to think of it that could work better in case theres errors, cuz my method can have a common mistake, ima research that more, thanks for the info man really appreciated
 

Users who are viewing this thread

Back
Top Bottom