Hi ,
In My project (Access 2007) , I Used a "Delete Query" To Delete A Record.
When The Query Is Runnig ,It Ask About Deleting A Record.
Can We Umit That Message?(In Other Hand , It Delete A Record Without Asking)
Thanks.
![]() |
Hi ,
In My project (Access 2007) , I Used a "Delete Query" To Delete A Record.
When The Query Is Runnig ,It Ask About Deleting A Record.
Can We Umit That Message?(In Other Hand , It Delete A Record Without Asking)
Thanks.
How are you triggering the query?
What do you mean?
A Delete query is an Access object that removes records from a table. To run a Delete query, you have to trigger it in some way. You could simply double click the query name in the Navigation Pane or you can call the query from a macro or on a button on a form.
If you are just running it from the Nav Pane, then there is no way to turn off the Warnings. If, you run it from a macro or from a VBA module, there are ways to turn off the warnings. That's why I asked how you trigger it so I can know what the best way to tell you how to do it is.
It would also help to know what record you are deleting or to see the SQL for the query. You would have to be providing some criteria for the query so you don't delete all the records in the table.
I click a button that it run a macro.
And criteria is : [Forms]![main_form]![Txt_del]
Ok, In the macro add a line before you execute the query:
SetWarnings False
After the query add a line:
SetWarnings True
I Tried , But I couldn't.
The Macro is Like The Follow , Can you Explain More ?
Macro Name :
Condition :
Action : OpenQuery
Argument :Q_Del,DataSheet,ReadOnly
I generally do not use macros they are too limiting. But in a macro each action is a line. What you show above is is the OpenQuery line. You need to ADD lines above and below that line to turn SetWarnings on and off.
The VBA code would be:
SetWarnings False
DoCmd.OpenQuery "Q_Del"
SetWarnings True
You don't need the other parameters for the OpenQuery method as they are the defaults.
I Added That Two Line , And The Result was This Error :
Compile Error: Sub Or Function Not Defined.
You added them to the macro? Did you pick SetWarnings from the list of Actions?
No, I didn't.
Now I do that , and finally it solve.
Thanks a lot.
You're welcome
All times are GMT -7. The time now is 09:19 AM. |