Query forms cancel

K

KC

I have several forms built on queries, after clicking the
button to open the form the parameter box comes up, if the
user enters a parameter and clicks okay everything works
just fine, but if the user clicks cancel the the form does
not open and the form the orginal button was on closes,
this is a problem especially since the database is locked
so this effectively closes the program completely. I have
put the following code and several veriations of it in the
code builder, but nothing has worked yet, can anyone help?

On Error GoTo Err_Handler

DoCmd.OpenQuery "Query Name"

Exit_This_Sub:
Exit Sub

Err_Handler:
If Err = 2501 Then
Else
MsgBox "Error # " & Err.Number & " " & Err.Description
End If
Resume Exit_This_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