PDA

View Full Version : keyDown



Moutaz Fino
10-20-2005, 12:04 AM
Hi ;
I try to use arrow key to navigate throw form record KeyDown to move down Keyup Moving up ..etc
Actually I use the following code and still has some conflict :


Private Sub Premium_90R_KeyDown(KeyCode As Integer, Shift As Integer)
On Error GoTo Err_Form_KeyDown

' MsgBox (KeyCode)
Select Case KeyCode
Case 40
DoCmd.GoToRecord , , acNext
KeyCode = 0
Case 38
DoCmd.GoToRecord , , acPrevious
KeyCode = 0
Case vbKeyReturn
DoCmd.GoToRecord , , acNext
KeyCode = 0
Case Else
End Select
'Exit Sub

Err_Form_KeyDown:
Select Case KeyCode
Case vbKeyDown
MsgBox "There are no more records to display", _
vbExclamation + vbOKOnly, "Warning ..."
Case vbKeyUp
MsgBox "You are already at the First Record", _
vbExclamation + vbOKOnly, "Warning ..."
Case vbKeyReturn
MsgBox "There are no more records to display", _
vbExclamation + vbOKOnly, "Warning ..."

Case Else
End Select
End Sub

If I update the field the code will be run and preview the error massage at same time
If I didn?t make any change in the field I?ll get error massage then it will move to next field . (Default movement)
:banghead:
Thank you

geekgirlau
10-20-2005, 02:24 AM
Welcome to the board!

Your "Exit Sub" is commented out - this means the code proceeds on to the error messages even when no error has occurred.

By the way, I've edited your post to put VBA tags around your code, to make the code easier to read. To do this next time, highlight all the text in the code and click on the "VBA" button.

Moutaz Fino
10-23-2005, 10:13 PM
Welcome to the board!

Your "Exit Sub" is commented out - this means the code proceeds on to the error messages even when no error has occurred.

By the way, I've edited your post to put VBA tags around your code, to make the code easier to read. To do this next time, highlight all the text in the code and click on the "VBA" button.
Hi ,

I?d like to thank Geekgirlau for help.

Even I did that or not no difference , actually I get same message but I?d like to clear that the flow of this process is strange to me.

This process dos not work with normal Direct ?Tab? ,if no change on the field

By

assigning with mouse click then
press Key Down ?The first result I get it is an error msg ? By
pressing again it is go to next Record
next pressing Error msg again
next pressing it is go to next Field.




I think that I miss some thing ,

How can I found Field status

After tap

On click

On entering mode ? etc





Thank you