Drop down list based on previous selection

K

Kimmy

I have made sort of a timeregistry with basic and simple tables.

Tabel Job contains (JobID, JobName, Startdate)
Tabel Assignment contains (AssignmentID, AsssignmentName)
Tabel Timeregister contains (key, JobName, AssignmentName, Enddate, Time
used etc...)
And a few other tables.

My question is this in my Form Timeregister, how do I make sure that once
JobName is selected in a dropdownlist, then the dropdownlist for
AssignmentName is automatically reduced to only contain data which is based
on my previous selection?
 
K

Ken Sheridan

Lets assume the first combo box is called cboJobs and the second
cboAssignments, in the RowSource of the latter include a parameter which
references the former. On the basis of your tables as you've described them
this would be along these lines:

SELECT AssignmentName
FROM TimeRegister
WHERE JobName = Forms!YourForm!cboJobs;

To update cboAssignment's list when a Job is selected you'd requery the
control in the AfterUpdate event procedure of cboJobs with:

Me.cboAssignment.Requery
 
U

URL Sales

Ken Sheridan said:
Lets assume the first combo box is called cboJobs and the second
cboAssignments, in the RowSource of the latter include a parameter which
references the former. On the basis of your tables as you've described them
this would be along these lines:

SELECT AssignmentName
FROM TimeRegister
WHERE JobName = Forms!YourForm!cboJobs;

To update cboAssignment's list when a Job is selected you'd requery the
control in the AfterUpdate event procedure of cboJobs with:

Me.cboAssignment.Requery
 
Top