Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box Fill List 1

Status
Not open for further replies.

ITProg

Programmer
Nov 9, 2004
43
US
I would like to fill a combo box list based on the value in the combo box above it on the same form. The first combo box lists staff departments. In the second combo box I would like to list staff names based on the department selected in the first combo box. The following query is from the row source in the second combo box. It only lists staff names from one department and does not change when I choose a different department.

SELECT [tblStaff].[LNAME] & ", " & [tblStaff].[FNAME] AS staff, [tblStaff].[DISCIPLINE] FROM tblStaff WHERE ((([tblStaff].[DISCIPLINE])=IIf(Trim([Forms]![frmReviews]![cmbOTHERName])="Recreational Therapy","RT",IIf(Trim([Forms]![frmReviews]![cmbOTHERName])="Occupational Therapy","OT","Physical Therapy")))) ORDER BY [tblStaff].[LNAME] & ", " & [tblStaff].[FNAME];

 
have you requeried the 2nd combo box using the afterupdate procedure in the 1st combo box.

if you let me know the names of the 2 combo boxes, then i can write the code for you...
 
The name of the first combo box is: [Forms]![frmReviews]![cmbOTHERName]. The name of the second combo box is: ([Forms]![frmReviews]![cmbOTHERBy]. The names to fill the second combo box are in table tblstaff.
 
In the AfterUpdate event procedure of cmbOTHERName add the following code:
Me!cmbOTHERBy.ReQuery
Just a note: you may simplify the cmbOTHERBy.RowSource like this:
SELECT LNAME & ", " & FNAME AS staff, DISCIPLINE FROM tblStaff WHERE DISCIPLINE=IIf(Trim(Me!cmbOTHERName)="Recreational Therapy","RT",IIf(Trim(Me!cmbOTHERName)="Occupational Therapy","OT","Physical Therapy")) ORDER BY 1;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top