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: 2

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

ranman256

Well-known Member
Joined
Jun 17, 2014
Messages
2,006
Put
On error résumé next
Before you open the query,And the error msg won't show.
 

Forum statistics

Threads
1,141,412
Messages
5,706,297
Members
421,439
Latest member
JordsdoExcel

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
Top