mjburgard
asked on
Database design
I am designing a database that will be used to collect information about usage of our center by students. I will be using SQL express as the back end and ACCESS as the front end of this database. I want to be able to have one of our coaches select the prefix for a class (e.g. MGMT or BGEN) and have a second drop down have all the course numbers that are available for that prefix (e.g. BGEN would show 194, 205, 312, and MGMT would show 255, 349, 447 etc.) What would be the best way to go about this? I could just have all the classes and numbers as one value that would be looked up, but that will become very cumbersome when you have well over 300 choices....
I am using SQL express 2014 and Access 2013.
I am using SQL express 2014 and Access 2013.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for mjburgard's comment #a40337530
for the following reason:
Exactly what I am looking for.
Accepted answer: 0 points for mjburgard's comment #a40337530
for the following reason:
Exactly what I am looking for.
ASKER
Exactly what I am looking for
You will need a table of all courses:
Table: tblCourse
Fields:
CoursePrefix,text,4
CourseNumber,Text,4
CourseDescription,Text,100
any other fields you think are appropriate like maybe an ActiveYN boolean field, etc..
But, for the example you are asking for, those three fields are good enough
So, the first combo box will have the rowsource set to:
SELECT Distinct "Course"."CoursePrefix" FROM "Course" ORDER BY "CoursePrefix"
The second combo will be populated in the first combo's AfterUpdate event:
Private Sub ComboPrefix_AfterUpdate()
ComboCourseNum.RowSource = "Select CourseNumber from Course Where CoursePrefix='" & Me.ComboPrefix & "' order by CourseNumber"
ComboCourseNum.Requery
Me.ComboCourseNum= Me.ComboCourseNum.ItemData (0)
End Sub
So, every time someone picks a choice from the first combo, the AfterUpdate event will re-populate the second combo with a list of course numbers for only the course prefix selected.
Table: tblCourse
Fields:
CoursePrefix,text,4
CourseNumber,Text,4
CourseDescription,Text,100
any other fields you think are appropriate like maybe an ActiveYN boolean field, etc..
But, for the example you are asking for, those three fields are good enough
So, the first combo box will have the rowsource set to:
SELECT Distinct "Course"."CoursePrefix" FROM "Course" ORDER BY "CoursePrefix"
The second combo will be populated in the first combo's AfterUpdate event:
Private Sub ComboPrefix_AfterUpdate()
ComboCourseNum.RowSource = "Select CourseNumber from Course Where CoursePrefix='" & Me.ComboPrefix & "' order by CourseNumber"
ComboCourseNum.Requery
Me.ComboCourseNum= Me.ComboCourseNum.ItemData
End Sub
So, every time someone picks a choice from the first combo, the AfterUpdate event will re-populate the second combo with a list of course numbers for only the course prefix selected.
ASKER