CarysW
Complete Access Numpty
- Local time
- Today, 17:46
- Joined
- Jun 1, 2009
- Messages
- 213
Hello again,
So I have error handling in the code of my Custome parameter forms to make sure that the user does not get bombarded if they decide not to save an export.
However, this obviously just corresponds to error number 2501.
I would like to create a msg box that pops up when any other error occurs, or even better add the text to the error message asking the user to make a note of the error number and to contact the Administrator.
Is this possible?
Here is an example of my code:
So I have error handling in the code of my Custome parameter forms to make sure that the user does not get bombarded if they decide not to save an export.
However, this obviously just corresponds to error number 2501.
I would like to create a msg box that pops up when any other error occurs, or even better add the text to the error message asking the user to make a note of the error number and to contact the Administrator.
Is this possible?
Here is an example of my code:
Code:
Private Sub cmdOKPL_Click()
On Error GoTo cmdOK_Error
' Open MsgBox to tell user that a save box will open next
MsgBox "Please Rename and Save The Export", vbQuestion, "Export To Excel"
' Exports Query to Excel
DoCmd.OutputTo acOutputQuery, "qryPL", "ExcelWorkbook(*.xlsx)", "", True, "", 0, acExportQualityPrint
' Closes Form
DoCmd.Close acForm, "frmChPL"
Exit Sub
cmdOK_Error:
If Err.Number = 2501 Then
Resume Next
Else
MsgBox "Error " & Err.Number & ": " & Err.Description
Resume Next
End If
End Sub