Filtering Combobox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a combobox of Department ID's. roughly 150 departments
In the query that this form is based on I have 6 contacts for each of the
department ID's along with thier email, phone etc.

I want to be able to see only the contacts that are attached to that
specific department in my "Contacts" Combobox. Once I have selected the
contact i want for that department I want thier phone #'s etc populated as
well...
Thanks in advance
 
Hi Erin,
Let's call the combo of department id combodep and the com of contacts
combocont.
I assume that the value combodep return is the department id.
On the after update event of combodep:
combocont.rowsource="select * (or just the fields you need in the combo)
from yourcontactquery where depID=" & combodep
combocont.requery
so you populate the combo contact with the values of the dep you choose in
the combodep.

on the afterupdate of combocont
assuming the combo contains in column1 the name of the contact, in column2
the phone etc.etc.
I assume you have on your form a field called contactname and one phone
me.contactname=combocont.column(1)
me.phone=combocont.column(2)

HTH Paolo
 
Back
Top