Exit Code

N

Nick

I would like to run some code to action a delete query
when I press a Quit button.
I have tried lots of combination.
Can anyone give me a clue? Please!

Regards
Nick

Private Sub Command22_Click()
On Error GoTo Err_Command22_Click

DoCmd.OpenQuery (qyDelete_tbWorkOrdersOlder365days),
[acViewNormal], [acEdit]
DoCmd.Quit

Exit_Command22_Click:
Exit Sub

Err_Command22_Click:
MsgBox Err.Description
Resume Exit_Command22_Click

End Sub
 
B

Brian

Nick said:
I would like to run some code to action a delete query
when I press a Quit button.
I have tried lots of combination.
Can anyone give me a clue? Please!

Regards
Nick

Private Sub Command22_Click()
On Error GoTo Err_Command22_Click

DoCmd.OpenQuery (qyDelete_tbWorkOrdersOlder365days),
[acViewNormal], [acEdit]
DoCmd.Quit

Exit_Command22_Click:
Exit Sub

Err_Command22_Click:
MsgBox Err.Description
Resume Exit_Command22_Click

End Sub

CurrentDb.QueryDefs("qyDelete_tbWorkOrdersOlder365days").Execute
dbFailOnError
 

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