Combo Box to Filter Contacts based on Letter of the Alphabet (1 Viewer)

Pauline123

Registered User.
Local time
Today, 22:23
Joined
Apr 1, 2013
Messages
69
Hi, am trying to figure out how to set a filter via a combobox selection.

My subform contains a list of suppliers. I would like to select from a combobox a letter from the alphabet and filter the subform based on the first letter of the suppliers company name.

Does anyone have any ideas.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:23
Joined
Aug 30, 2003
Messages
36,126
In the after update event of the combo:

Me.SubformName.Form.RecordSource = "SELECT Blah FROM TableName WHERE Company Like '" & Me.ComboName & "*'"
 

jaccessable

Registered User.
Local time
Today, 14:23
Joined
Feb 12, 2016
Messages
13
Does your subform already contain a complete list of suppliers that you'd like to filter or are you filling an empty listbox? And, I'm assuming your subform contains a listbox for the list?
 

Pauline123

Registered User.
Local time
Today, 22:23
Joined
Apr 1, 2013
Messages
69
Hi Paul - I have tried this and keep getting "Compile Error: Method or Data Member Not Found"

This is he code entered in the after update of the combo box:

Me.SupplierContactSub.Form.RecordSource = "SELECT SupplierName FROM qrySupplierContactList WHERE SupplierName Like '" & Me.ComboAlphabet & "*'"

My subform is called "SupplierContactSub" and its record source is a query "qrySupplierContactList".

Can you shed any light :)
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:23
Joined
Aug 30, 2003
Messages
36,126
The combo is on the main form, right? Make sure that's the name of the subform control, if different than the subform itself.
 

Pauline123

Registered User.
Local time
Today, 22:23
Joined
Apr 1, 2013
Messages
69
Sorry my subform is called "SupContInsertForm"

The main form where the combo box is located is called "SupplierContactSub"
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:23
Joined
Aug 30, 2003
Messages
36,126
I'm confused, but you want the name of the subform control there. Can you attach the db here?
 

Pauline123

Registered User.
Local time
Today, 22:23
Joined
Apr 1, 2013
Messages
69
Hi Paul have attached the database
 

Attachments

  • FilterProb.mdb
    604 KB · Views: 106

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:23
Joined
Aug 30, 2003
Messages
36,126
Like I said, you need the name of the subform:

Me.SupContInsertForm.Form.RecordSource =
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:23
Joined
Aug 30, 2003
Messages
36,126
Oh, and I deleted the master/child links plus the main form's record source since it wasn't used.
 

Pauline123

Registered User.
Local time
Today, 22:23
Joined
Apr 1, 2013
Messages
69
Hi Paul thank you so much for your help - that kinda did the trick - just created another problem so I think I need to go back to basics to see what I have done wrong. Thanks again :)
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:23
Joined
Aug 30, 2003
Messages
36,126
No problem, post back if you're still having trouble (perhaps a new thread if the topic is different).
 

Users who are viewing this thread

Top Bottom