Cascade Combo Boxes

G

Guest

I have a form on which I would like to have two combo boxes that update
fields in an Advertising Activity table. The combo box first pulls up a list
of customer names (from a customer table), the second combo would have only
those records associated with the customer name chosen (from an Advertisement
table). The results of the combo boxes are placed in the Advertising Activity
Table.

Can this be easily accomplished? Thanks.
 
B

Bill

Add code to the AfterUpdate event in the Customer Names combo box. In the
code, build the SQL for the recordsource of the second combo box and then
suff that SQL in to the recordsource property for the second combo box.
Something like:

Dim foo as string

foo = "SELECT * FROM tAdvertisment WHERE CUSTOMERID = " & me.CustomerID

me.AdvertisingComboBox.RecordSource = foo


This will cause the second combo box to be requeried and it will fill with
the records that correspond to the Customer Name that was selected.


Bill Nicholson, Access Dufus
Cincinnato, OH USA
 

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

Top