Combo filter

Xenix

Registered User.
Local time
Today, 15:43
Joined
Oct 8, 2001
Messages
124
Hello,

I have a problem with a combo box, it just looks up contact names, but I can't get it to filter out only the contacts that relate to the customer code.

Private Sub Combo12_AfterUpdate()
'Find the record that matches the control.
Dim rs As Object

'stLinkCriteria = "
Code:
=" & "'" & Me![CODE] & "'"
    'DoCmd.OpenForm stDocName, , , stLinkCriteria
    
    'DoCmd.ApplyFilter , Code = Me![Code]

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[Contact] = '" & Me![Combo12] & "'"
    Me.Bookmark = rs.Bookmark
End Sub

can anyone help me?  above is a list of all the code I have tried  [img]http://www.access-programmers.co.uk/ubb/frown.gif[/img]

thank you 
Mike
 
It sounds like you have a One (customer) to Many (contacts) relationship. If that is so then you want a form/subform where the Main form is based on the Customer and the Subform is based on the Contacts. Selecting the Customer in the Main form will show you the Contacts for that Customer in the Subform.
 
Yes that is what I have done, but to select that contact, I have a pull down box as in the code above, the problem is it shows all the contacts for every customer, can't get it to just display those for CODE=Customer Code

Mike
 
I am confused about what you are trying to do. If you have a form/subform combination and your Master/Child links are setup properly then you should only see the contacts in the subform that belong to the customer in the main form. You combo box on the main form should select the customer, not the contact.
 

Users who are viewing this thread

Back
Top Bottom