5 replies
by jhermiz
This *error* is generally triggered when reports are canceled..Im surprised you are receiving it with forms. With reports if you cancel the operation you get "The OpenReport action was cancelled" which isn't really an error. You are experiencing the same thing with forms. The solution is quite simple..all you have to do is use error handling and find out which error this is. For instance, if the Err.Number was 1300. Then in your event handler you could do the following:
sub OpenForm()
On Error Goto Err_Handler
DoCmd.OpenForm "frmMyForm"
Done:
Exit sub
Err_Handler:
If Err.Number = 1300 then
'dont display that message you are getting
else
MsgBox Err.Description, vbCritical, "Error #: " & Err.Number
Resume Done----------------
That should do the trick just replace 1300 with the real error number. To find out what error number it is just MsgBox the Err.Number in your code.
Good Luck,
Jon
by egarcia
by timfox
Have you tried stepping through your code?
The message that you are seeing is not the actual error that occurs. If MS-Access encounters an error with the OpenForm event, and the error is not internally dealt with (ie - you would need to add errortrapping code here), then it will cancel the OpenForm event and provide you with the error message that you do actually see. What you would need to do is determine the reason why the OpenForm method is encountering an error.
The form that you areopening may be referencing a field on the form with the command button. If that original form is closed before the new field can extract the value, then it could cancle the open form method and give you the error that you see. This could explain thesome PCs bit. Fast PCs will close the first form too quickly, slow PCs will allow the original form to be open just long enough for the value to be extracted and used before that form is closed.
If this is the problem - then find out what the link is between the two forms and resolve the OpenForm / CloseForm problem - global variables are not pretty, but may help.
If the problem is not with the link between the forms, then look at the values (hidden and shown) that are on the new form. Where do the values come from? Is there any reason why these fields cannot be completed?
You could try breaking things down a bit in your code - maybe try capturing the actual error that occurs using the 'On Error GoTo' method.
Just an idea - hope it helps!
TimFox
by egarcia
by egarcia
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending