Private Sub Command32_Click() On Error GoTo Command32_Click_Error_Routine Dim sFilename As String sFilename = "U:\Data\err" & Format(Now(), "yyyymmddHHMMSS") & ".txt" MsgBox "Raise Error" Err.Raise 2424 ' Should never get here MsgBox "!!!" Command32_Click_Exit_Routine: Exit Sub Command32_Click_Error_Routine: Open sFilename For Output As #1 Print #1, "Industrial Computer Contracts (West Midlands) - Error Log - 28th April 2012" Print #1, Now() Print #1, Me.Name Print #1, Err.Number Print #1, Err.Description Print #1, CurrentDb.Name Print #1, "**END**" Close #1 Resume Command32_Click_Exit_Routine End Sub |