Preventing Record Changing

  • Thread starter Thread starter JamesJ
  • Start date Start date
J

JamesJ

Is there a way to prevent the user from moving
to another record during editing? I don't want the
BeforeUpdate or AfterUpdate to fire unless a
button is clicked.

Thanks,
James
 
On PgUp and PgDown, set the keycode parameter to 0.

Check out "Access Cookbook" published by O'Reilly
 
I've disabled the pgup and pgdown but my mouse
wheel still moves to other records. I've even disabled
the mouse wheel in the mouse settings. I found some
code at http://www.lebans.com/ which I haven't tried yet .
I just thought there was some way to lock the record or
something.

Thanks,
James
 
Create a Module-level Variable "fOKtoSave".

* In the Form_BeforeUpdate Event, check the above Variable and if it is
False, cancel (the BeforeUpDate Event)

* In the Form_AfterUpdate Event, set it to False.

* In your CommandButton_Click Event (to save the Record), set it to True and
then save your Record.

This way, the only way the Form_BeforeUpdate Event will be cancelled (and
hence saving is also cancelled.) unless the user uses your CommandButton.
You may want to use the MsgBox to advise the user so ...
 
Open your form in design mode,

Open the Properties window and select the form

Got to the Other tab, and in the box that is labeled Cycle, select 'Current
Record'

This will prevent you from changing records when you leave the last control
on the form. Unfortunately, this will not disable the mouse wheel. To do
that, take a look at this article.

http://www.microsoft-accesssolutions.co.uk/disable_mousewheel.htm

HTH
Dale
 
Back
Top