"The OpenForm action was canceled"

  • Thread starter Thread starter John Phelan-Cummings via AccessMonster.com
  • Start date Start date
J

John Phelan-Cummings via AccessMonster.com

After creating a button on a (parent) form linking to another (child) form,
I received the following error when clicking on the command button:

"The OpenForm action was canceled"

No the child form is not a subform.

I should also add that I created code in the properties window stating that
the "child" "number" field on the form (that I was navigating to), was
equal to the "autonumber" field that I was navigating from.

Also, on the child form I created code that equated certain other "text"
fields equal to fields on the parrent form in order to populate those
fields, i.e., first and last name.

Finally, the parent form is also a link child form to another parent
(again, not a subform). Yes, the first and last name fields is the
information, that appear in the second and third forms,and origionly
entered on the first and top form.

John
 
This is usually caused of the form you're opening can do a check then close
itself by canceling the open in its Open event. If this is the case, you
just need to trap the error using an error handler in the calling code.
 
Example of error trapping on the On Open event:

On Error GoTo Error_Handler

......

Error_Handler:
If Err.Number <> 0 Then 'there is an error
If Err.Number <> 2501 Then 'it is not from cancel of the open event
MsgBox Err.Description, vbOKOnly, "Error #" & Err.Number
End If
End If
 
Back
Top