you need to use some sort of error handling to protect any operation unless you are absolutely sure it cant fail.
the setwarnings true and false are really used to suppress output from queries
eg, when you manually execute an update query, you get the "you are about to update x messages", and more importantly, your users can stop exection by saying "No"
by surrounding the query with the setwarnings code you
a) suppress the messages and
b) prevent users being able to crash out of importnat processes
so you get
docmd.setwarnings false
docmd.openquery "my update query"
docmd.setwarnings true
now the only problem is, is that you are also suppressing warning messages - so say this is an insert query, and some inserts fail., then you dont get informed that this has happened.
If this is important you can use instead
on error goto fail:
currentdb.execute "my update query" ,dbfailonerror
msgbox("Completed")
'prevent code falling into the error handler
exit sub
fail:
error handling here
.... but now, you have ot add your own error handling
docmd.setwarnings true
-------
finally note that in a error handler you HAVE to close it with a resume statement - dont just goto, as you cannot set another error trap until you resume from the first