Link to home
Start Free TrialLog in
Avatar of mjburgard
mjburgardFlag for United States of America

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.
ASKER CERTIFIED SOLUTION
Avatar of pdebaets
pdebaets
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mjburgard

ASKER

After a quick scan, this appears to be exactly what I am looking for.  Grazie!
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.
Exactly what I am looking for
Avatar of Jerry_Justice
Jerry_Justice

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.