Auto Acknowledge Access Message Box Prompts

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Sorry

Newish to the Forums and not surte where best to post this question

Looking for a method to automatically acknowledge access prompt boxes from
VBA ... Using a Make Table Query in VBA and dont want the associated popup
prompts ... Can I auto respond to these from within VBA ???

Many Thanks for any assistance
 
Rather than respond to them automatically, how about preventing them from
happening at all?

You can do this be issuing a DoCmd.SetWarnings False before you run the
query (and DoCmd.SetWarnings True afterwards), or (better in my mind), you
can use the Execute method of either the database or, if you've saved the
Make Table query, of the query itself.

Assuming you've got a Reference set to DAO, it would be something like:

CurrentDb.Execute strSQL, dbFailOnError

(where strSQL contains the SQL of your Make Table query), or

CurrentDb.QueryDefs("MyMakeTableQuery").Execute dbFailOnError

(where MyMakeTableQuery is the name of your saved query)

Adding dbFailOnError means that your error trapping routine will detect any
errors that might occur.
 
Alan said:
Sorry

Newish to the Forums and not surte where best to post this question

Looking for a method to automatically acknowledge access prompt boxes
from VBA ... Using a Make Table Query in VBA and dont want the
associated popup prompts ... Can I auto respond to these from within
VBA ???

Many Thanks for any assistance

Three methods...

Turn of confirmations gloablly in Tools - Options (not recommended)

Assuming your using DoCmd.RunSQL...

DoCmd.SetWarnings False
DoCmd.RunSQL "QueryName"
DoCmd.SetWarnings True

Or my choice...

CurrentDB.Execute "QueryName", dbFailOnError

The last does not produce the confirmation prompts and is easier to set up error
handling for.
 
Back
Top