Solved - rs.FindFirst and Multiple Column ComboBox
Hello All:
I am having another problem with my record lookup. I might have multiple orders in the 'Orders Table' with the same name but different parameters (PrimaryWorkGroup, SecondaryWorkGroup). What is happening is if I have a record like this:
Order PrimaryWorkGroup SecondaryWorkGroup
-----------------------------------------------------
Glucose ED ED
Glucose ED-Council ED-Council
If I select the first one, the second one will display. If I select the second one, the second one will display
Another example:
Order PrimaryWorkGroup SecondaryWorkGroup
-----------------------------------------------------
Chem7 ED
Chem7 ED-Council
Note that there is no PrimaryWorkGroup..If I select either one it
will display the first one.
The issue has to do with multiple orders. If there is a singular order and I select it, it will display fine. Any ideas?
I am using Access XP. I have an unbound combo box that is set for displaying three columns and the bound column is one. I have a query in the rowsource as follows:
SELECT DISTINCT [OrderName], [PrimaryWorkGroup], [SecondaryWorkGroup] FROM Orders ORDER BY [OrderName], [PrimaryWorkGroup], [SecondaryWorkGroup];
Here is what I have in my after_update subroutine:
Private Sub cbosOrderName_AfterUpdate()
Set rs = Me.Recordset.Clone
rs.FindFirst "[OrderName] = '" & Me![cbosOrderName] & "'"
'rs.FindFirst ("[OrderName] = '" & Me![cbosOrderName] & "' AND '[PrimaryWorkGroup] = '" & Me.cbosOrderName.Column(3) & "' AND '[SecondaryWorkGroup] = '" & Me.cbosOrderName.Column(4) & "'")
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Thank you for any advice,
Tony
|