Combo Box control by tab (1 Viewer)

md-rahim

Registered User.
Local time
Today, 14:57
Joined
Dec 7, 2012
Messages
36
Dear All,

In different office application we see that drop down combo box is possible to control by pressing Tab button and drop by arrow key from key board. But I can't do this in Ms Access Database which I built.

So, How I can control the combo box value by pressing tab button and value select by arrow key pressing.

Please help me anybody.

Rahim
 

billmeye

Access Aficionado
Local time
Today, 03:57
Joined
Feb 20, 2010
Messages
542
In the On Key Down event for the combobox add code similar to this adjusting for your control name etc.:
Code:
20    With Me.Combo1
30           Select Case KeyCode
                 Case vbKeyDown
40                   If .ListIndex < .ListCount - 1 Then
50                       .Value = .ItemData(.ListIndex + 1)
60                   Else
70                       DoCmd.Beep
80                   End If
90                   KeyCode = 0
100              Case vbKeyUp
110                  If .ListIndex > 0 Then
120                      .Value = .ItemData(.ListIndex - 1)
130                  Else
140                      DoCmd.Beep
150                  End If
160                  KeyCode = 0
170              Case Else
                     ' do nothing
180          End Select
190      End With

You must have the forms Key Preview event set to Yes.
 

Users who are viewing this thread

Top Bottom