Error when cancelling query

R

rblivewire

I have a switchboard and on the switchboard is a combo box with my list
of queries. The user can choose any query from this combo box. Some
queries have it set u so it asks for a parameter value. If the user
cancels this request, I get a runtime error and it asks to debug. How
do i get this runtime error from not showing up when the user cancels
the request?
 
F

fredg

I have a switchboard and on the switchboard is a combo box with my list
of queries. The user can choose any query from this combo box. Some
queries have it set u so it asks for a parameter value. If the user
cancels this request, I get a runtime error and it asks to debug. How
do i get this runtime error from not showing up when the user cancels
the request?

Trap Error 2501 in the event on the switchboard form that opens the
query.

On Error GoTo Err_Handler
DoCmd.OpenQuery etc....
Exit_Sub:
Exit Sub
Err_Handler:
If Err = 2501 Then
Else
MsgBox "Error " & Err.Number & " " & Err.Description
End If
Resume Exit_Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top