S
sebastico
Hello
John W. Vinson helped me with a code to search records in a Table to show in
lsbAut
Private Sub CmdA_Click()
Dim strSQL As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
strSQL = "SELECT AuID, AutName FROM TAut WHERE AutName LIKE 'A*' _
& " ORDER BY AutName;"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
If rs.RecordCount > 0 Then
Me!lsbAut.RowSource = strSQL
Else
MsgBox "No records in DB"
End If
rs.Close
Set rs = Nothing
End Sub
Now I would like to do is:
1. In lsbAut select a record by AutID
2. Search selected record in TAutObID
‘There is at least one record in TAutObID
‘TAutObID has only two fields AuID and ObID
3.If AutID record is found show the record with AuID, ObId Fields in lbsObID
I tried walking the listbox collection looking for similar application. I
could not find any. I found this “You could also use an unbound list box to
find a record based on the value you select in the list boxâ€. However, I
could not found a code to select a row in a listbox.
Could you suggest me a code.
Any help is appreciated
John W. Vinson helped me with a code to search records in a Table to show in
lsbAut
Private Sub CmdA_Click()
Dim strSQL As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
strSQL = "SELECT AuID, AutName FROM TAut WHERE AutName LIKE 'A*' _
& " ORDER BY AutName;"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
If rs.RecordCount > 0 Then
Me!lsbAut.RowSource = strSQL
Else
MsgBox "No records in DB"
End If
rs.Close
Set rs = Nothing
End Sub
Now I would like to do is:
1. In lsbAut select a record by AutID
2. Search selected record in TAutObID
‘There is at least one record in TAutObID
‘TAutObID has only two fields AuID and ObID
3.If AutID record is found show the record with AuID, ObId Fields in lbsObID
I tried walking the listbox collection looking for similar application. I
could not find any. I found this “You could also use an unbound list box to
find a record based on the value you select in the list boxâ€. However, I
could not found a code to select a row in a listbox.
Could you suggest me a code.
Any help is appreciated