help with error handling

kevinh2320

Board Regular
Joined
May 13, 2016
Messages
61
I have a button on my form with name "run-q-letters-send-by-date-30-Day" This button has an On Click event with this code:

Private Sub run_q_letters_send_by_date_30_Day_Click()

DoCmd.OpenQuery "q-letters-send-by-date-30-Day", acViewNormal, acReadOnly

End Sub

Clicking the button brings up the dialog box shown below and if I enter a date and click OK the query loads as intended.
1585696741877.png

However, if I click Cancel I get the error shown below that I don't know how to resolve.

1585696883600.png
 

Attachments

  • 1585696716181.png
    1585696716181.png
    5.6 KB · Views: 4

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Put
On error résumé next
Before you open the query,And the error msg won't show.
 
Upvote 0

Forum statistics

Threads
1,215,016
Messages
6,122,700
Members
449,092
Latest member
snoom82

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top