Wow do I suppress the message box after each DoCmd.DoSQL statement

The follow code in Access prompts me to confirm each statement.  Can this be turned off?

Option Compare Database

'------------------------------------------------------------
' Build_800000
'
'------------------------------------------------------------
Function Build_800000()
On Error GoTo Build_800000_Err

    ' delete from 800000
    DoCmd.RunSQL "delete from 800000", -1
    ' insert into 800000 select * from 801000 where label > ''
    DoCmd.RunSQL "insert into 800000 select * from 801000 where label > ''", -1
    ' insert into 800000 select * from 802000 where label > ''
    DoCmd.RunSQL "insert into 800000 select * from 802000 where label > ''", -1
    ' insert into 800000 select * from 803000 where label > ''
    DoCmd.RunSQL "insert into 800000 select * from 803000 where label > ''", -1
    ' insert into 800000 select * from 804000 where label > ''
    DoCmd.RunSQL "insert into 800000 select * from 804000 where label > ''", -1
    ' insert into 800000 select * from 805000 where label > ''
    DoCmd.RunSQL "insert into 800000 select * from 805000 where label > ''", -1
    ' insert into 800000 select * from 301000 where label > ''
    DoCmd.RunSQL "insert into 800000 select * from 301000 where label > ''", -1
    ' insert into 800000 select * from 302000 where label > ''
    DoCmd.RunSQL "insert into 800000 select * from 302000 where label > ''", -1
    ' insert into 800000 select * from 311000 where label > ''
    DoCmd.RunSQL "insert into 800000 select * from 311000 where label > ''", -1
    ' insert into 800000 select * from 312000 where label > ''
    DoCmd.RunSQL "insert into 800000  select * from 312000 where label > ''", -1


Build_800000_Exit:
    Exit Function

Build_800000_Err:
    MsgBox Error$
    Resume Build_800000_Exit

End Function
KalvynAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
You can use:

  DoCmd.SetWarnings False
  <do stuff>
  DoCmd.SetWarnings True

/gustav
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KalvynAuthor Commented:
That is just what I was looking for.  I wonder how I could get this to run when I exit the database or close Access?
0
Gustav BrockCIOCommented:
You can set it permanently under Options.

There is no "exit event" in Access. You could create your own by opening a (hidden) form at launch and put some code in the OnUnload of this. It will run as the form will be closed prior to the closing down of Access.

/gustav
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.