HOW TO AVOID MESSAGE WHEN RUNNING QUERIES

I'm getting warning messages when I try to run some queries,
msg "the existing tables will be deleted befor you run the query'
I cleared the action queries option but still I'm getting this message
heyne230Asked:
Who is Participating?
 
Dale FyeConnect With a Mentor Commented:
Two ways.  The first is to set warning off and then turn them on again.

Docmd.SetWarnings False

'do something

Docmd.SetWarnings True

The problem with this method is that you loose all visibility of any warnings.  the other is that if the code between the SetWarnings False and True generates an error, you  might not get to the SetWarnings True line, and would miss messages that you really want to see.

I prefer to use the Execute method.  The syntax looks something like:

Currentdb.Execute strSQL, dbFailOnError

or if it is a stored query:

Currentdb.querydefs("queryname").Execute dbfailonerror

The advantage of this method is that it blocks the warnings but will still throw an error which you can handle in an error handler routine.
0
All Courses

From novice to tech pro — start learning today.