When I enter a listbox and I hit up or down, I would like it to cycle through options of the listbox without leaving the control. Each time I hit up or down it leaves, and it seems as though that I cannot get it to focus back on the original listbox.
If possible I would like it to not leave the listbox in general. I have tried .setfocus on other controls and then .setfocus back on the original, that does not work. I have also tried DoCmd.GoToControl (ctrl).
the "On Key Down" on each points to this function...
Code:
Function newkeypress(Keycode As Integer, Shift As Integer)
Dim thectrl As String, ctrl As Control, count As Integer, frm As Form
If Keycode = 40 Then
thectrl = Screen.ActiveControl.Name
Set frm = Forms("Warranty Return Addition")
Set ctrl = frm.Controls(thectrl)
count = ctrl.ListCount
With ctrl
If ctrl.Value = "" Then
ctrl = .ItemData(0)
ElseIf .Value = count Then
ctrl = .ItemData(0)
Else
ctrl = .ItemData(.Value)
End If
DoCmd.GoToControl ("txtdatecode")
DoCmd.GoToControl (.Name)
End With
Else
Exit Function
End If
End Function