Cascade Combo Boxes

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
Back
Top