T
timbits35 via AccessMonster.com
Hi,
I have an unbound box to search and select an athlete in a sales form. It
works only partially. Each athlete can have several sales records for each
contract year and there are some athletes with the same last name. I want to
be able to select the record based on the contract year. But when I try to
select the year that I want it just selects the first record. Here is my code
and the information from the recordsource box.
SELECT qrysales.Lname, qrysales.Fname, qrysales.SalesID, qrysales.
contractyear FROM qrysales ORDER BY qrysales.Lname;
Private Sub cbosearch_AfterUpdate()
' Find the record that matches the control.
On Error GoTo ProcError
Dim rs As Object
Set rs = Me.RecordsetClone
rs.FindFirst "[Lname] = '" & Me![cbosearch] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
ExitProc:
Exit Sub
ProcError:
MsgBox "Error: " & Err.Number & ". " & Err.Description
Resume ExitProc
End Sub
I have an unbound box to search and select an athlete in a sales form. It
works only partially. Each athlete can have several sales records for each
contract year and there are some athletes with the same last name. I want to
be able to select the record based on the contract year. But when I try to
select the year that I want it just selects the first record. Here is my code
and the information from the recordsource box.
SELECT qrysales.Lname, qrysales.Fname, qrysales.SalesID, qrysales.
contractyear FROM qrysales ORDER BY qrysales.Lname;
Private Sub cbosearch_AfterUpdate()
' Find the record that matches the control.
On Error GoTo ProcError
Dim rs As Object
Set rs = Me.RecordsetClone
rs.FindFirst "[Lname] = '" & Me![cbosearch] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
ExitProc:
Exit Sub
ProcError:
MsgBox "Error: " & Err.Number & ". " & Err.Description
Resume ExitProc
End Sub