Delete Query on Forms

G

Guest

I cannot seem to add a command button on a form that supports the Delete
Query function. Is this possible?
 
K

Ken Snell [MVP]

The Delete Query function? You mean you want to run a delete query by
clicking a button on the form?

Assuming that this is indeed what you want to do, use code similar to this
for the Click event of the button:

Private Sub CommandButtonName_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "DeleteQueryName"
DoCmd.SetWarnings True
End Sub
 
G

Guest

Thanks so much!

Ken Snell said:
The Delete Query function? You mean you want to run a delete query by
clicking a button on the form?

Assuming that this is indeed what you want to do, use code similar to this
for the Click event of the button:

Private Sub CommandButtonName_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "DeleteQueryName"
DoCmd.SetWarnings True
End Sub
 
Joined
Jul 14, 2010
Messages
1
Reaction score
0
Follow up Question

Hello,

I'm looking to do something similar to this process. I have a table that houses historical data (let's call it "History"). It's got an agent's name, call event, and date & time of the event. I want to be able to pull up a form, enter in a start and end date, and click okay and run a Delete Query to purge records in the "History" table that fall between that date. Is that possible? (Sort of like marrying the "Query by Form" process and "Delete Query".
 

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

Top