Re: Undo when move to next record or close form

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



It isn't working either when navigating to the next record because when I hit
the next record button, I see it goto the next record, then I get the pop-up,
and I assure you my code is in the Before Update.
There is no reason to keep the form open when they close it, its just
screwing up because if they change the field, then close the form, my pop-up
is still coming up because its firing on Before Update, yet the form is still
closing and the record is still getting saved.

JimBurke wrote:
I'm guessing that your code is working for when you navigate to a a new
record - Before Update should handle that. If they close the form, is there
any reason to keep it open, or is it simply a matter of saving the changes if
they enter the correct password? If you may need to keep the form open for
any reason, put code in the forms UnLoad event proc, and cancel the On Unload
event if you want to keep the form open. Otherwise use the On Close proc. In
either case, If they made changes and don't enter the right password, undo
the changes. Then, if you have a situation where the form should stay open,
in the On Unload, after undoing the changes, set Cancel = True and that will
cancel the closing of the form. On Close does not have a Cancel option, On
Unload does.

Hello Jim, thanks for your reply.
You are right, its not a subform, its a pop-up form.
[quoted text clipped - 23 lines]
That will prevent incorrect data entry if the user tries to close the
form with the incorrect entry.


--
Message posted via http://www.accessmonster.com

.



Relevant Pages

  • Re: Undo when move to next record or close form
    ... any reason, put code in the forms UnLoad event proc, and cancel the On Unload ... You are right, its not a subform, its a pop-up form. ... I can't prompt when the form opens, has to be done after a change is made to ...
    (microsoft.public.access.modulesdaovba)
  • RE: Code to Implement Required Cells Not Working
    ... Cancel As Boolean) ... Dim iCell As Variant ... "a Reason Category has been selected.", ... "Change Type has been selected.", ...
    (microsoft.public.excel.programming)
  • Re: Simon is impersonating me.
    ... TeamB, and by association CG, are to maintain their reputation. ... explanation, and so would have to stay their hand. ... If the reason for concellation is obvious, ... BUT if there IS NO REASON to cancel, ...
    (borland.public.delphi.non-technical)
  • Re: Passing to and back from Dialog
    ... Private Sub Form_Unload ... ' And in the calling form: ... No, The event fires before unloading, so at that time you have the chance to cancel the unloading. ... The 'Cancel = 1' is what cancels the unload. ...
    (microsoft.public.vb.general.discussion)
  • RE: onformunload
    ... Private Function VerifyCloseForm() As Boolean ... It seems that it failed when I set cancel to true. ... Did you try debugging with a breakpoint to see if the Unload event is firing ...
    (microsoft.public.access.formscoding)