Combobox Value Based On Another Combobox

MCCDOM

Registered User.
Local time
Today, 08:15
Joined
Oct 30, 2014
Messages
84
I have two comboboxes on my form one 'cboMake' and the other 'cboModel'. Both of their values are stored in individual columns ('Make' and 'Model') in the same table 'tblStock'. What I would like to achieve is when I select a value from 'cboMake' that 'cboModel' will filter it's data values to only display Models that are linked to Make i.e. if I select Make Logitech I would like it to only display the following results for Model: 'K120', 'K200', 'G500', 'G502' etc. and not display any of the other values associated with another Make.

I look forward to your suggestions.

Regards and Happy Christmas
 
Where would I put the second options code. Would it go under an after update of the first combobox?

Thanks
 
Yes, first combo. Did you look at the sample db?
 
Yes, I did look at the sample db and got mine working; thank you. I just have a couple of questions. With the criteria of the query you have chosen 'CA' and not 'NV'. Why is this? Is there any difference in which you use. Secondly my second combo won't display only unique values even though I selected 'Yes' to 'Unique Values' in the query property sheet.

Many thanks
 
Sorted the unique value. I just needed to put 'DISTINCT' after 'SELECT' so it reads like this: strSource = "SELECT DISTINCT Model " & _
 
If you mean the row source of the second example, that is the one that is changed dynamically in the code. If you choose NV, it gets changed.
 

Users who are viewing this thread

Back
Top Bottom