Populate 2nd cbobox after selection in 1st cbobox

  • Thread starter Thread starter Evan McCutchen
  • Start date Start date
E

Evan McCutchen

Does anyone know of a way to populate a second combobox based on the
selection of a first combobox? My situation is this: In our invoice printing
system, we have a table called companies, and a table titled reps. The reps
have a field called "company" in which one we put what company they work for
(the company name we list is in the company table). On our main invoice
form, we'd like to be able to select the company name from a combo box, and
then below in another combo box, see all of the reps that relate to that
company.

Does anyone have any ideas?? I've figured out how to populate the text
boxes, but the combo boxes perplex me. :)

Thanks alot!
Evan McCutchen
evan AT radiologyonesource DOT com
 
In the company combo box's AfterUpdate eventhandler, put
code something like the following

{repComboBox}.RowSource = "SELECT {repNameColumn} FROM
{repTable} WHERE {companyColumn} = ' & {companyComboBox} & "'"

You will have to replace {repComboBox}, {repNameColumn},
{repTable}, {companyColumn}, {companyComboBox} including {}
with the names from your application.

Hope This Helps
Gerald Stanley MCSD
 
Gerald, thanks for your reply, I believe that will work. I've been assigned
to another duty for the morning, so I wont be able to test it until later.
Thanks!

Evan McCutchen
evan AT radiologyonesource DOT com
 
Back
Top