[AccessD] "Key up" not always "up"

Billy Pang tuxedoman888 at gmail.com
Wed Jun 13 18:25:37 CDT 2007


Hello:

In MS Access 2003, I'm trying to emulate the key up / down behavior of a
datasheet for a continuous form but something quirky is happening.  Right
now when the user presses the "down arrow" key, it moves down to the field
directly below.  But when when pressing the "up arrow" key, it moves up and
to the left???  does anyone know why this is happening?

Here are the steps to recreate this:

1) begin with a table with three fields and about 10 records.

2) create a new form (continuous form) with the three fields showing.

3) on form properties, turn on key preview.

4) implement the following:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
   If KeyCode = vbKeyDown Then
      DoCmd.GoToRecord , , acNext '<--  this moves cursor down perfectly
   End If
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
   If KeyCode = vbKeyUp Then
      DoCmd.GoToRecord , , acPrevious ' <-- this moves cursor up and to the
left???
   End If
End Sub

5) go to form view.  key down several times (works according to plan!)

6) key up several times (it does not go up directly; cursor goes up and to
the left).

thanks in advance,

Billy
-- 
Billy Pang
http://dbnotes.blogspot.com/
"Once the game is over, the King and the pawn go back in the same box." -
Italian proverb



More information about the AccessD mailing list