|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Making a selection from a combo box.
I have a combo box where the user chooses the state. I would like to have it act like the combo box everyone is familiar with where if you hit the same letter, it cycles through the choices in that letter. For example, if I hit "O" twice I want it to cycle to Oklahoma instead of typing "OO" in the box, or if I hit it one more time, I want it to cycle to Oregon. How would I go about doing this in my combo box? Thanks.
|
|
#2
|
|||
|
|||
|
I don't believe that it is possible with the standard Access ComboBox to do what you are asking. If you find someone who can show you how to do this I would appreciate you posting that information here, as i am interested.
S- |
|
#3
|
|||
|
|||
|
Here's the Solution
The following code is in my KeyDown function of a combobox named State. The combobox has two columns (ID, Name). This is the link where I got the info to give the other guy credit.
URL Code:
Dim CurItem as Long, LastItem as Long, I as Long
CurItem = Me.State.ListIndex
LastItem = Me.State.ListCount - 1
If CurItem < LastItem Then
For I = CurItem + 1 To LastItem Step 1
If UCase(Left(State.Column(1,I),1)) = UCase(Chr(KeyCode)) Then
Me.State.ListIndex = I
Exit For
End If
Next I
End If
If Me.State.ListIndex = CurItem Then
For I = 0 to CurItem
If Left(Me.State.Column(1,I),1) = UCase(Chr(KeyCode)) Then
Me.State.ListIndex = I
Exit For
End If
Next I
End If
If State.ListIndex = CurItem Then
'Opps, we didn't find a match.
End If
'This will force the entry from not entering the letter in the textbox of the combobox.
KeyCode = 0
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Making a selection from a combo box. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|