I have placed an Unbound listbox on my bound form. The listbox's rowsource is an SQL query. Is it possible to Search within the listbox rowsource and find the ordinal position of a row?
There is a common field between my form's RecordSource and the listbox's rowsource which is "Pay_ID". So whenever my form moves to a record I would like to search the listbox's rowsource by the form's "Pay_ID" control value and get the ordinal position and select the listbox using the Me.lstBankPay.Selected(x) = True formula. I have tried the following method but it does not seem to give accurate result.
Code:'Dim rsR As Recordset 'Set rsR = Me.lstBankPay.Recordset 'On Error Resume Next 'rsR.FindFirst "Pay_ID = " & Me.Pay_ID 'If Not rsR.NoMatch Then 'Me.lstBankPay.Selected(rsR.AbsolutePosition - 1) = True 'End If 'rsR.Close 'Set rsR = Nothing