Combo/Select Distinct

C

Cyndi

Ok I am an accountant(knows a little about computers) so assume I am a
complete dunce -

I have a database multiple tables - one table has the customer ID and
the year I am looking for - but the customer name is actually in
another table

I want to do 2 combo boxes

the first would select customer name _________________

and then the second would pop up the year(s) we have in the table
______________

I have printed(off this) multiple articles about combo boxes and
select distint row but none seem to fit my problem where I only have
the ID in the main table not the whole name.

Thanks in advance for any help
 
D

Douglas J. Steele

Your first combo box should be based on a query of your customer that
returns the ID and name. Display the name in the combo box, but have the ID
field as the bound column. In the AfterUpdate event of that combo box, put
code that builds a simple SQL string to be the source of the second combo
box.

strSQL = "SELECT CustomerYear FROM CustomerYearTable " & _
"WHERE CustomerId = " & Me.cboCustomer & " " & _
"ORDER BY CustomerYear"

With Me.cboCustomerYear
.RowSourceType = "Table/Query"
.RowSource = strSQL
End With

(Obviously since I don't know the details of your application, I couldn't
use appropriate names in the example above)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top