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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems cancelling opening of a form with VB

Status
Not open for further replies.

aexley

Technical User
Jul 9, 2001
147
GB
This is a copy of a post in the 'Forms' forum (not sure which one it should be in) so my apologies to anyone who has already seen it.

I am opening a form, if this form opens onto a new record I need Access to open a message box that requests whether data is transferred to this form or not or the action is cancelled. If the action is cancelled the user is put back to the form they originated from.

The first two parts work fine (after much tweaking), my problem is that when the user tries to cancel I get the following message:

'This action can't be carried out while processing a form or report event'

And then Access opens the form anyway. I have the necessary code in the OnCurrent Event in the target form. I have tried using CancelEvent but I can't get it to work. Any ideas?

Thanks in advance,

aexley

QFTD: "If your washing powder got your whites whiter than white and your colours brighter than ever..why do we need a new one? Whats next nuclear white?"
 
Hi,
I don't know if it will help but why don't you try the BeforeUpdate event? Let me have the results of your endeavor.
 
Unfortunately, what happens is that the BeforeUpdate event seems to be cancelled OK but I lose the other functionality i.e. the automatic insertion of information before the user starts typing.

The sequence should be as follows:

A) User clicks button on FormA to open FormB or user moves to a new record on already open FormB

B) FormB opens.

C) 'YesNoCancel' Message box opens

D) If 'Cancel' FormB closes and user is taken back to FormA

E) If 'Yes' new record in FormB is filled with info from FormA.

F) If 'No' FormB is opened blank.

As mentioned in my original post, the 'No' and the 'Yes' actions work fine but the 'Cancel' doesn't.

Any ideas?

Thanks In Advance,

aexley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top