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
 
Top