[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2004-11-14
3
Medium Priority
?
694 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:Kalvyn
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Gustav Brock earned 200 total points
ID: 12579961
You can use:

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

/gustav
0
 

Author Comment

by:Kalvyn
ID: 12580583
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
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 12593229
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question