StuLux
Well-known Member
- Joined
- Sep 14, 2005
- Messages
- 679
- Office Version
- 365
- Platform
- Windows
The following code is producing error 2501 at the line indicated, the code was working fine and I had previoulsy added error handling to effectively ignore this error but the error handler no longer picks up this error - can anybody explain why?
I have additional code in the Form_BeforeUpdate event but this merely runs through the controls on the form and produces msgbox prompts if any of the entries do not compy with certain rules. I'm not aware of making any chnages to this code from when it was working OK so I'm at a complete loss.
I have additional code in the Form_BeforeUpdate event but this merely runs through the controls on the form and produces msgbox prompts if any of the entries do not compy with certain rules. I'm not aware of making any chnages to this code from when it was working OK so I'm at a complete loss.
Code:
Private Sub cmdClosefrmProjects_Click()
On Error GoTo Err_cmdClosefrmProjects_Click
Call Audit
If Me.Dirty Then
DoCmd.RunCommand acCmdSaveRecord 'ERROR OCCURS HERE
End If
DoCmd.Close acForm, Me.Name
Exit_cmdClosefrmProjects_Click:
Exit Sub
Err_cmdClosefrmProjects_Click:
Select Case Err.Number
Case 2501 'Ignores the "run command action was cancelled" error
Case Else
msgbox "Error " & Err.Number & ": " & Err.Description, vbCritical, "modName.FunctionName"
End Select
Resume Exit_cmdClosefrmProjects_Click
End Sub