The OpenForm action was cancelled

Ally

Registered User.
Local time
Today, 07:22
Joined
Sep 18, 2001
Messages
617
I have an opening form from which you can add a patient. When you enter the patient’s unique id, if the patient already exists, code tells you so and takes to you another form from which you can search for the patient and find their record.

BUT, when you search and open their record an error message comes up:

“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.”

... and I haven't touched cancel!!!

The only option is OK; the form opens but is missing the patient’s name.

I tried debugging but that errored part of the way through because I couldn’t do something in Design View so I am stuck.

Anyone got any ideas please???

[This message has been edited by Ally (edited 01-17-2002).]
 
You need to add "Error Handling" to the Routine. Here is an example of what you need:

Private Sub YourSubName_AfterUpdate()
On Error GoTo Err_Handler

'
' Your Code Here
'

Err_Handler:
  If Err.Number = 2501 Then
  &nbsp Resume Next
  Else
    MsgBox Err.Number & vbCrLf & Err.Description
    Resume Next
  End If
End Sub

HTH
RDH

[This message has been edited by R. Hicks (edited 01-17-2002).]
 
That's great. Thank you very much.

Ally
 

Users who are viewing this thread

Back
Top Bottom