Well, here's the code which I use to insert the current record in the textbox into the listbox. I'm not sure if it'll help you help me, as it's probably difficult without the rest of the program, which is almost 3000 lines of code so it would be kind of difficult to paste it in here...
Basically, I allow the user to search for any record, and when a record is found, it displays the name of that record in the listbox, then say the user freely moves about the records in the textbox using the Data Control. Now the user wants to go back to that record that was found earlier and placed in the listbox. So he clicks that record in the listbox, which SHOULD bring that record back up in the textbox. Maybe that's a better explanation, I don't know.
If you can't provide extra help, that's ok, and thanks.
.datPersonal.Recordset.FindFirst "fldLastName = " & "'" & txtFind.Text & "'"
If (.datPersonal.Recordset.NoMatch = True) Then
MsgBox "Found no instances of " & txtFind.Text, vbInformation, "Find"
Else
.lstPersonal.AddItem (.txtLastNameP.Text & ", " & .txtFirstNameP.Text)
Do Until .datPersonal.Recordset.EOF
.datPersonal.Recordset.FindNext "fldLastName = " & "'" & txtFind.Text & "'"
' If no match exists, inform the user
If (.datPersonal.Recordset.NoMatch = True) Then
If (.lstPersonal.ListCount > 1) Then
MsgBox "Found " & .lstPersonal.ListCount & " instances of " & txtFind.Text, vbInformation, "Find"
Else
MsgBox "Found " & .lstPersonal.ListCount & " instance of " & txtFind.Text, vbInformation, "Find"
End If
Exit Do
Else
.lstPersonal.AddItem (.txtLastNameP.Text & ", " & .txtFirstNameP.Text)
End If
Loop
End If
Enter your message below
Sign in or Join us (it's free).