Solved Run-time error 2001

Eric the Viking

Registered User.
Local time
Today, 12:28
Joined
Sep 20, 2012
Messages
70
Dear All
I have a form with a series of buttons that when clicked export data to an Excel spreadsheet using VBA like this:

Private Sub cmdOpenEnterMembersDebitsAndReceipts_Click()
DoCmd.OutputTo acOutputQuery, "qryAccountantSubReceiptsAfterYearEnd", acFormatXLSX, "c:\Documents\SubsPaidAfterYearEnd.csv"
End Sub

This is to provide .csv spreadsheets for our club accountants.
My issue is with the query prompt to enter dates. If I run the query and then press cancel without entering a date nothing happens. If I press the button on the form but then decide to cancel without entering a date I get the following error:
Run-time error 2001
with the option to end or debug.
If an incorrect format date is entered then I get:
Run-time error 3071
Is there a way of suppressing these messages or avoiding them being seen? I ask because sometimes it will not be me doing this but someone non-tech who will likely be bamboozled by the message.
Here's hoping.
 
Add error handling to manage those error values.
Whilst you could suppress the error messages completely, end users might be more confused when the routine fails with no warnings.
Suggest you instead add a more 'user friendly' message as part of the error handling
 
Add error handling to manage those error values.
Whilst you could suppress the error messages completely, end users might be more confused when the routine fails with no warnings.
Suggest you instead add a more 'user friendly' message as part of the error handling
Thanks for the suggestion, done and works a treat. Happy bunny :)
 

Users who are viewing this thread

Back
Top Bottom