Private Sub cboSearchColorNum_KeyDown(KeyCode As Integer, Shift As Integer)
' *******************************************************************
' * Cannot get to change the value shown in the combo box when *
' * moving through records with keystrokes! *
' *******************************************************************
' Move through records utilizing keyboard strokes of the DOWN & UP ARROW keys.
Me.KeyPreview = True ' Turn KeyPreview on so the following actions occur:
Dim i As Integer
Select Case KeyCode ' Do one of two actions depending on the key:
Case 40
[B][COLOR=Red]DoCmd.GoToRecord , , acNext[/COLOR][/B] ' If the down arrow key is pressed move to the next record.
For i = 0 To cboSearchColorNum.ListCount - 1
If CStr(cboSearchColorNum.Column(0, i) & "") = CStr(Nz(Me.txtHiddenColorNum, "")) Then
MsgBox "I got here"
cboSearchColorNum.Selected(i) = True
Exit For
End If
Next
Case 38
[COLOR=Red][B]DoCmd.GoToRecord , , acPrevious[/B][/COLOR] ' If the up arrow key is pressed move to the previous record.
For i = 0 To cboSearchColorNum.ListCount - 1
If CStr(cboSearchColorNum.Column(0, i) & "") = CStr(Nz(Me.txtHiddenColorNum, "")) Then
MsgBox "I got here"
cboSearchColorNum.Selected(i) = True
Exit For
End If
Next
End Select
End Sub