How to run a query using code?

P

pokdbz

How do you run a query using code? I have a delete query named
ProviderDelete. How do I run this using code?
 
R

Rick B

If you add a button to your form, the button wizard will build the code for
you. It is in the "miscellaneous" category.
 
W

Wayne Morgan

Using the query name,

CurrentDb.Execute "ProviderDelete", dbFailOnError

There are modifications on the syntax, depending on how you're wanting to do
it. This will run without any prompting or warning, but will return and
error and undo what it may have already done if something fails.
 
P

pokdbz

Perfect. Exactly what I was looking for.


Wayne Morgan said:
Using the query name,

CurrentDb.Execute "ProviderDelete", dbFailOnError

There are modifications on the syntax, depending on how you're wanting to do
it. This will run without any prompting or warning, but will return and
error and undo what it may have already done if something fails.
 
Top