Is there a way to make the first item in a list box the record displayed on the screen?
I have a data entry screen. The user selects a record to edit by selecting a Category from a Combo box then all the items under that Category are displayed in a list box. My problem is the displayed record on the form is not the first in the list box. The user must click on the list box to change the record pointer (Displayed record on the form). This has lead to some errors and not to happy people.
Private Sub cmbCategory_AfterUpdate()
lstItem.Requery
lstItem.SetFocus
lstItem.ListIndex = 0
Call lstItem_AfterUpdate
End Sub
Private Sub lstItem_AfterUpdate()
' Find the record that matches the control.
Dim RS As Object
Set RS = Me.Recordset.Clone
RS.FindFirst "[CamId] = '" & Me.lstItem & "'"
Me.Bookmark = RS.Bookmark
End Sub
I have a data entry screen. The user selects a record to edit by selecting a Category from a Combo box then all the items under that Category are displayed in a list box. My problem is the displayed record on the form is not the first in the list box. The user must click on the list box to change the record pointer (Displayed record on the form). This has lead to some errors and not to happy people.
Private Sub cmbCategory_AfterUpdate()
lstItem.Requery
lstItem.SetFocus
lstItem.ListIndex = 0
Call lstItem_AfterUpdate
End Sub
Private Sub lstItem_AfterUpdate()
' Find the record that matches the control.
Dim RS As Object
Set RS = Me.Recordset.Clone
RS.FindFirst "[CamId] = '" & Me.lstItem & "'"
Me.Bookmark = RS.Bookmark
End Sub