Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run time error 2501

Status
Not open for further replies.

Arob

Technical User
Jul 25, 2001
55
0
0
US
I have a simple command button to open a form. Below is the code

Private Sub property_Click()
DoCmd.OpenForm "frmhospitalpropertyedit1"
End Sub

However when clicking on the button, I receive this error.

Run-time error '2501'
The OpenForm action was cancelled
You used a method of the DoCmd object to carry out an action in visual basic, but then clicked cancel in a dialog box.
For example, you used the close method to close a changed form, then clicked cancel in the dialog box that asks if you want to save the changes you made to the form.

I'v tried all kinds of things and can't get the error to go away. If anyone has any ideas, please help.
 
Hi Arob!

Put a control break at the open form command and see what code is running before the cancellation. Somewhere Access is deciding that you don't want the form open after all.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top