Running Delete QRY with a Macro

David McDermott

New Member
Joined
Sep 10, 2008
Messages
13
As a new user I am having a bit of a problem. I have several tables that I have created delete query's for and a macro to run all of the queries in succession. When I run the macro it stops at every query and asks me if i really want to delete XXX number of rows in my table. I click on yes and the next delete query asks the same thing. is there a way to disable this "safety check" built into this process?

Thanks in advance for anyones help
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
add this to the start of your macro below the sub line

Application.DisplayAlerts = False

then at the end of your macro above the End Sub add
Application.DisplayAlerts = True
 
Upvote 0
add this to the start of your macro below the sub line

Application.DisplayAlerts = False

then at the end of your macro above the End Sub add
Application.DisplayAlerts = True


Again as a new user of Access I did not ask the question correctly - so thank you for your quick response and I apologize for imprecise language.

I am recording a macro using the macro recorder built into the tools of Access and i am not writing lines of VBA so i can't add the TRUE and FALSE to my macro. Is there some other way to accomplish this?
 
Upvote 0
I think Lynn may have thought it was an Excel question, not an Access one. But Access has an action similar to the Excel VBA "Application.DisplayAlerts".

In your macro, before your Action queries, add a "SetWarnings" Action, and set the value to "No".
Then at the very end, add another "SetWarnings" Action and set this one to "Yes".

Note that is you do not see the "SetWarnings" option listed in your Action choices, click on the "Show All Actions" in the Show/Hide ribbon (this is one of those Actions that is hidden by default in newer versions of Access).
 
Upvote 0
I think Lynn may have thought it was an Excel question, not an Access one. But Access has an action similar to the Excel VBA "Application.DisplayAlerts".

In your macro, before your Action queries, add a "SetWarnings" Action, and set the value to "No".
Then at the very end, add another "SetWarnings" Action and set this one to "Yes".

Note that is you do not see the "SetWarnings" option listed in your Action choices, click on the "Show All Actions" in the Show/Hide ribbon (this is one of those Actions that is hidden by default in newer versions of Access).


This works!! thanks for the help. I am certain I will be asking lots more.
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,121
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top