Populate 2nd cbobox after selection in 1st cbobox

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
 
G

Gerald Stanley

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
 
E

Evan McCutchen

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
 

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