Disable Arrow Keys?

Funger

Registered User.
Local time
Today, 16:03
Joined
Jan 16, 2004
Messages
18
I made a related post yesturday about Subform Navigation...

I want to control the way a user navigates around a continuous forms subform. I would like the interface to act in much the same way that excel does.

I would like the up and down arrow keys to navagate up and down a record, but stay in the same column.

I would like the right and left arrow keys to move from column to column.

I would like the page up, page down to move an entire page up or down respectivly.

And I would like the user to be able to click on any cell, and move the focus there.


I am having a few problems.
First, I wrote code to jump to the previous and next records. I am using a recordset clone of the subform and setting bookmarks. I seems to work just dandy, except when I get to the first or last records... then Access is running some process other then my code. The AbsolutePosition of the recordset gets set to -1.

Second, When I use the mouse and the page up/down buttons, access doesn't change the AbsolutePosition or Bookmark of the subform's recordset. So, when I use the arrow keys after clicking or using the page keys, the focus jumps back to the last record that had the focus before clicking or using the page keys.

Please help! The users of this database will not let that kind of bug slide. :(

-Funger
 
You could use a datasheet or this code
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
On Error GoTo Form_KeyDown_Err
Select Case KeyCode
Case vbKeyDown
DoCmd.GoToRecord Record:=acNext
KeyCode = 0
Case vbKeyUp
DoCmd.GoToRecord Record:=acPrevious
KeyCode = 0
Case Else

End Select

Form_KeyDown_Exit:
Exit Sub

Form_KeyDown_Err:
Select Case Err.Number
Case adhcErrInvalidRow
KeyCode = 0
Case Else
MsgBox "Error: " & Err.Description & _
" (" & Err.Number & ")"
End Select
Resume Form_KeyDown_Exit
End Sub
 
Thank you. this works much better then bookmarks.
 

Users who are viewing this thread

Back
Top Bottom