Re: Page Down Key Action

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



Put this code on the form, and set the form's Cycle property to
currentrecord. You may have to experiment with the count numbers for your
particular form, or adjust the length of the form somewhat. The ct is a
variable that is global for the form.

Private Sub Form_Current()
ct = 1
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'33 - PgUp; 34 - PgDown;
Select Case KeyCode
Case 33
ct = ct - 1
If ct <= 1 Then
KeyCode = 0
ct = 1
End If
Case 34
ct = ct + 1
If ct > 2 Then
KeyCode = 0
ct = 3
End If
Case Else

End Select
End Sub

Private Sub Form_Load()
Me.KeyPreview = True
End Sub


"B F Cole" <bfcole@xxxxxxxxx> wrote in message
news:45e461f3$0$5228$4c368faf@xxxxxxxxxxxxxxxxx
I have a form that is larger than one screen vertically.. The user can
scroll down or press the Page Down key to get to the bottom. If the user
presses Page Down twice, the form goes to a new blank record which I want
to prevent. I know how to disable the Page up & Page Down keys, how to
count the number of times the key has been pressed, etc, but how do I
prevent Page Down on a form from going to a new blank record? There should
be a parameter that controls this action or locks the form to the current
record only. I haven't found it. Any suggestions?

Thanks,
Bill



.



Relevant Pages

  • Re: Linking the ENTER key to a Button on a Form?
    ... Your textbox name is TextBox1, ... Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ... When the user types into the Text Box and presses ...
    (microsoft.public.excel.programming)
  • Re: OnKey problem
    ... its the one that stops a character from being printed (usually used when one presses Shift, Ctrl or Alt is pressed in combination with a letter in order to stop the letter from appearing in the TextBox)... ... Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ... ByVal Shift As Integer) ... MsgBox "You pressed Shift+N" ...
    (microsoft.public.excel.programming)
  • Re: How to jump between TextBoxes
    ... > Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ... > Dim bBackwards As Boolean ... > Select Case KeyCode ... >> Jose Luis ...
    (microsoft.public.excel.programming)
  • RE: Actual Date
    ... database, it will show you exactly how to use it. ... calendar from it which is worked perfect but the Filter doesn't work. ... Private Sub cmdMonthDown_Click ... Select Case KeyCode ...
    (microsoft.public.access.gettingstarted)
  • Re: Keypress Event on Control
    ... Your code references the name KeyAscii, but that's not the name of the ... KeyDown receives the KeyCode ... Private Sub txtRemark_KeyDown(KeyCode As Integer, Shift As Integer) ...
    (microsoft.public.access.formscoding)