Idiot proof!

  • Thread starter Thread starter Jeff Klein
  • Start date Start date
J

Jeff Klein

Is there a way to stop the form from scrolling records in the table that it
is sourced to. I have my form opening and going to new record and I don't
want the user to accidentally backup to the previous record. I have
disabled the Nav buttons but certain keystrokes will also scroll records.
Page up and page down are the ones I know of but there are probably more.
 
You need to set the form's Key Preview property to 'Yes' for the following
code to work ...

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

Select Case KeyCode
Case vbKeyPageUp, vbKeyPageDown
KeyCode = 0
Case vbKeyUp, vbKeyDown, vbKeyHome, vbKeyEnd
If Shift And acCtrlMask Then
KeyCode = 0
End If
End Select

End Sub

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Jeff,

Open your form in design view, open properties, go to the Data tab and set
Data Entry to Yes.
 
Back
Top