Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a query with a confirmation dialog 1

Status
Not open for further replies.

mmartinez74

Technical User
Nov 20, 2002
9
US
I have the following code in an Access 2000 database, it is designed to archive a table with the date.

Dim strSQL As String
strSQL = "SELECT tbl_BillingMaster.* INTO [archive" & Date & "] FROM tbl_BillingMaster;"
DoCmd.RunSQL strSQL

When this runs, the user is prompted with a box which confirms the operation. Eventually I will be running this on multiple tables and do not want the user to be prompted for the action on each one. Is there a way that I can turn these prompts off?
 
Yes!

Just before your DoCmd.RunSQL statement, add the following statement:

DoCmd.SetWarnings False

This turns off all "warnings" that Access generates including those confirmation messages that go along with deleting or adding records to a table.

Immediately after the DoCmd.RunSQL statement, add another statement to set the warnings back on:

DoCmd.SetWarnings True

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top