How to run a query using code?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do you run a query using code? I have a delete query named
ProviderDelete. How do I run this using code?
 
If you add a button to your form, the button wizard will build the code for
you. It is in the "miscellaneous" category.
 
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.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top