Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trap a specific event and Code number for TAB key hit.

Status
Not open for further replies.

david2001

Technical User
Oct 2, 2001
24
0
0
GB
Is there a kind of "move to next record event" in Access 2000 and also how do I make something happen when the TAB key is hit.

Move to next record event.
What I want is Access to perform a action (in this case resting a controls property) when the user changes from the current record in a form to a different one (just as if they had used the Navigation Buttons at the bottom of a form). The record they move to could be either a new one or existing ???

When TAB key is hit.
This is quite simple on paper but I do not know the correct codes to use. I have a simular event that happens using code that a kind fellow forum member posted for me but that is for an event to happen when the enter key is hit. I guess setting it for a TAB hit would be simular.

Just so that you know, here is the code for the enter key hit event: I use "If KeyCode = 13 Then".

Is there a list somewhere that gives theses numbers and the keys they corespond to so I dont have to keep pestering you guys for you precious time?

My grateful Thanks in advance,

David
 
Here is a partial list
-----------------------
' Key Codes
Global Const KEY_LBUTTON = &H1
Global Const KEY_RBUTTON = &H2
Global Const KEY_CANCEL = &H3
Global Const KEY_MBUTTON = &H4 ' NOT contiguous with L & RBUTTON
Global Const KEY_BACK = &H8
Global Const KEY_TAB = &H9 '<<<<<< TAB
Global Const KEY_CLEAR = &HC
Global Const KEY_RETURN = &HD '<<<< Enter Key
Global Const KEY_SHIFT = &H10
Global Const KEY_CONTROL = &H11
Global Const KEY_MENU = &H12
Global Const KEY_PAUSE = &H13
Global Const KEY_CAPITAL = &H14
Global Const KEY_ESCAPE = &H1B
Global Const KEY_SPACE = &H20
Global Const KEY_PRIOR = &H21
Global Const KEY_NEXT = &H22
Global Const KEY_END = &H23
Global Const KEY_HOME = &H24
Global Const KEY_LEFT = &H25
Global Const KEY_UP = &H26
Global Const KEY_RIGHT = &H27
Global Const KEY_DOWN = &H28
Global Const KEY_SELECT = &H29
Global Const KEY_PRINT = &H2A
Global Const KEY_EXECUTE = &H2B
Global Const KEY_SNAPSHOT = &H2C
Global Const KEY_INSERT = &H2D
Global Const KEY_DELETE = &H2E
Global Const KEY_HELP = &H2F

' KEY_A thru KEY_Z are the same as their ASCII equivalents: 'A' thru 'Z'
' KEY_0 thru KEY_9 are the same as their ASCII equivalents: '0' thru '9'

Global Const KEY_NUMPAD0 = &H60
Global Const KEY_NUMPAD1 = &H61
Global Const KEY_NUMPAD2 = &H62
Global Const KEY_NUMPAD3 = &H63
Global Const KEY_NUMPAD4 = &H64
Global Const KEY_NUMPAD5 = &H65
Global Const KEY_NUMPAD6 = &H66
Global Const KEY_NUMPAD7 = &H67
Global Const KEY_NUMPAD8 = &H68
Global Const KEY_NUMPAD9 = &H69
Global Const KEY_MULTIPLY = &H6A
Global Const KEY_ADD = &H6B
Global Const KEY_SEPARATOR = &H6C
Global Const KEY_SUBTRACT = &H6D
Global Const KEY_DECIMAL = &H6E
Global Const KEY_DIVIDE = &H6F
Global Const KEY_F1 = &H70
Global Const KEY_F2 = &H71
Global Const KEY_F3 = &H72
Global Const KEY_F4 = &H73
Global Const KEY_F5 = &H74
Global Const KEY_F6 = &H75
Global Const KEY_F7 = &H76
Global Const KEY_F8 = &H77
Global Const KEY_F9 = &H78
Global Const KEY_F10 = &H79
Global Const KEY_F11 = &H7A
Global Const KEY_F12 = &H7B
Global Const KEY_F13 = &H7C
Global Const KEY_F14 = &H7D
Global Const KEY_F15 = &H7E
Global Const KEY_F16 = &H7F

Global Const KEY_NUMLOCK = &H90
-----------------------------------

Not sure what you are after. Access allows you to set an Option in the &quot;Tools&quot; menu &quot;Options&quot; to stop at the last and first field or move to the next record.
What the Enter key does etc. DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
You can use KeyCode Constants instead of the actual number

KeyCode = vbKeyTab
instead of
KeyCode = 9

Open the Object Browser and type in Keycode, and you should see a list of all of the VBA KeyCode Constants. Access 97 had this list in the Help File, but I can't seem to pull it up in 2K.

PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top