WHY isn't setwarnings *working*!?

Access9001

Registered User.
Local time
Today, 04:26
Joined
Feb 18, 2010
Messages
268
I normally set the warnings equal to false, run some recordset loops that throw down some maketables, and then set my warnings to true. For some reason it isn't working in this particular database and it is driving me crazy. Under what circumstances would setting warnings to false NOT suppress the "you're about to delete this table / run a maketable / etc" warnings?
 
How do you set the warnings? The syntax are:

DoCmd.SetWarnings False
...
..
DoCmd.SetWarnings True

A better way is to use the Execute command then you don't have to turn on/off the warnings.

CurrentDb.Execute ("NameOfQuery"), dbFailOnError

JR
 
Yes, I do just that.

When I try to use CurrentDb.Execute ("NameOfQuery") though, the query still throws errors at me (table still exists so it'll throw down the warning).
 
Yes MakeTable queries will throw an error regardless. If you use this alot then you might have a structure problem. Normally you create the table once and then you append/delete records.

If you still want to do it like you do, then you must first delete the table(s) before you execute the makeTable queries

JR
 
I have another database where I use similar queries with the warning flags / make table structure and it doesn't prompt me for anything. I am just not sure why this one is.
 
somewhere else in your database you must be turning the warnings back on
 
The queries are in the form of "select ______ into (Table Name) from (linked DBF file)"
 
Try using Docmd.RunSQL instead of Currentdb.Execute for the Make Table query.
 
the dowarnings portion seemed to work when I put it in my rs loop.

Before I was doing something like this:

docmd.setwarnings false

while not rs.eof
docmd.openquery (rs("blahblah"))
rs.movenext
wend

rs.close
set rs=nothing
docmd.setwarnings true



Once I moved the warning flags INSIDE the loop immediately around the docmd.openquery portion, it didn't prompt me any further. Wonder what was turning it back on.
 

Users who are viewing this thread

Back
Top Bottom