Howlsta
Vampire Slayer
- Local time
- Today, 22:23
- Joined
- Jul 18, 2001
- Messages
- 180
The code below runs a delete query which works fine, but sometimes a user might press the command button and the delete query has no records. What i'm really saying is how can I give the user a error/help message if they press the button and there are no records to delete.
I turned off the warning as they are still the same anyway whether there are records to delete or not.
Any Ideas?
Private Sub cmdWithdraw_Click()
On Error GoTo Err_cmdWithdraw_Click
Dim stQry As String
stQry = "qDelOption"
DoCmd.SetWarnings False
DoCmd.OpenQuery stQry, acNormal, acEdit
DoCmd.SetWarnings True
Me.lboOptions.Requery
Exit_cmdWithdraw_Click:
Exit Sub
Err_cmdWithdraw_Click:
MsgBox Err.Description
Resume Exit_cmdWithdraw_Click
End Sub
I turned off the warning as they are still the same anyway whether there are records to delete or not.
Any Ideas?
Private Sub cmdWithdraw_Click()
On Error GoTo Err_cmdWithdraw_Click
Dim stQry As String
stQry = "qDelOption"
DoCmd.SetWarnings False
DoCmd.OpenQuery stQry, acNormal, acEdit
DoCmd.SetWarnings True
Me.lboOptions.Requery
Exit_cmdWithdraw_Click:
Exit Sub
Err_cmdWithdraw_Click:
MsgBox Err.Description
Resume Exit_cmdWithdraw_Click
End Sub