Form accidentally moving to a new record

chappy

Registered User.
Local time
Today, 15:03
Joined
Nov 5, 2003
Messages
30
Does anyone know of a keystroke or keystroke combination that will make a form, set to cycle through one record only, go to a new record? I have designed a small invoice database for a retail store, and one of the store's employees manages to inadvertently jump to a new invoice record (in the middle of a sale, no less :( ) by pressing shift+tab. No combination of shift, tab, ctrl or alt that i've tested has been able to reproduce this event. The only way i've been able to replicate what's happening is by pressing pagedown, however the employee claims only to be pressing shift+tab.
The occurrence is random and isolated to one employee, so i'm guessing this employee is hitting pagedown without realizing it, but I'd like to give her the benefit of the doubt. Any ideas?

-Chappy
 
Hello. I don't think that the problem is a combination of buttons that are being pushed. If you tab through all of the controls on the form, once you get to the last control and press tab, it will automatically take you to the next record on default. This also happens if you just highlight whatever the last control is in the Tab Order list and then press tab.

There is an option to change this so that you can just tab through the record without go to the next record.
Go to the Form's properties and under the Option tab change the CYCLE property to Current Record instead of All Records. That should fix it.
 
Thanks for the reply! The problem is that I've already set the form to cycle through the current record only. In my testing I've held down the tab key (and various combinations of tab, shift, alt and ctrl) for minutes at a time and the form keeps cycling through the current record as you'd expect it to. However this employee manages to jump to a new record despite the cycle property being set to Current Record.

-Chappy
 
Pat Hartman said:
Is the problem being caused by scrolling the mouse wheel? If so, search here for code to solve the problem.

Scrolling the mouse wheel will move to a new record, however none of the computers here have mouses (mice?) with wheels :confused: I've disabled the pagedown key, hopefully that will help.
 
ghudson said:
You need to test if the current record is 'Dirty' using the forms BeforeUpdate event.

If the record is not Dirty then the form's BeforeUpdate event won't run. As the record hasn't been changed, what need is there to update it?
 
Mile-O-Phile said:
If the record is not Dirty then the form's BeforeUpdate event won't run. As the record hasn't been changed, what need is there to update it?
Based on chappy's quote below, it sounds like his user is moving to a new record in the middle of a sale which I believe means that the current record is being modified [dirty]. I could be wrong and maybe chappy will respond if he needs more assistance with this problem.

chappy said:
one of the store's employees manages to inadvertently jump to a new invoice record (in the middle of a sale, no less :( )
 
[clutching straws]Is he sure he's got the Cycle property set to Current Record?[/clutching straws] :rolleyes:
 
Mile-O-Phile said:
[clutching straws]Is he sure he's got the Cycle property set to Current Record?[/clutching straws] :rolleyes:

Yes, he's quite sure. I have to wait and see if disabling the pagedown will prevent further occurrences. As I mentioned before they dont' have wheel-equipped mice, so disabling that would be overkill. Thanks for the suggestions.
 
chappy said:
As I mentioned before they dont' have wheel-equipped mice, so disabling that would be overkill. Thanks for the suggestions.
My method will prevent the user from moving to another record no matter what buttons they press and/or if they use a mouse scroll button unless they click the custom Save or Undo buttons [if the record is dirty] I posted in that sample db.
 
more mouse wheel stuff

I realise the mouse issue has probably long gone but I've been using the following method to prevent users moving records with a mouse wheel.

This method takes advantage of the fact that when a form's record is advanced by the mouse wheel the form_current event is repeated, but not the form_load event. If the mouse wheel is used the user is thrown straight out of the form after a message box explaining the action.

The form_current and form_load events include the following code (in addition
to whatever else is required):

(The form.cycle = current record)

Public mousewheel as integer

---------------------
Private Sub Form_Load
mousewheel = 1
End Sub
---------------------

Private Sub Form_Current
mousewheel = mousewheel + 1
If mousewheel > 2 then msgbox "<message explaining mouse problem>": exit sub
End Sub
------------------------

After this, I have event procedures in the OnMouseMove of any object (text box, label, etc..) that is directly under where the mouse pointer lies after the user presses ok in the message box called in form_current. e.g:

Private Sub txtbox_MouseMove
If mousewheel > 2 then docmd.close
End Sub

This closes the form before the user can edit the record.

Its crude, but it has done the job for a while now within various databases.
 

Users who are viewing this thread

Back
Top Bottom