04-04-04, 17:51 #1Registered User
- Join Date
- Apr 2004
Unanswered: Creating Individual Student Schedule Using Dlookup
I know this is simple, but I just cannot get it. I am trying to create a form for our guidance counselor that will automatically complete the form once the course is entered.
CourseData table contains the following field names with info below each:
Course Code Teacher Period Room
Math 3222 Miller Block 1 5
Code would be the unique identifier as it would be a different code for each course. I thought I could select the course and dlookup the code, teacher, period, and room.
All student data imports with no problem. In the form I created a dropdown combo box for choosing the course. The other fields are separate boxes. After the course is chosen I would like the other boxes to automatically complete.
Thanks so much
04-04-04, 20:27 #2Stuck on my opinions...
- Join Date
- Nov 2003
What you are asking will be very difficult to do with the DLookUp function
since there are always more than one Math courses. DLookUp is more specific to one record rather than to several.
Your best bet would be to leave the Courses as a selection via ComboBox (such as you have now) but also make the Code TextBox (convert it) into a ComboBox as well.
Now....Make the Code combobox auto-fill (via SQL statement in RowSource) dependant of what is selected within the Courses combobox.
Now...upon selection of the desired Code for the specific Course required (and remember...you can display several columns in a combobox to make the selecttion precise) you can use the DLookUp function to fill the other necessary fields.
If you require further assistance with this then E-Mail a sample of your database and I will be happy to set things up for you so that you can see how this can be accomplished.
04-04-04, 20:48 #3Registered User
- Join Date
- Sep 2001
- Chicago, Illinois, USA
Both methods will yield the same result but CyberLux's methodology is the "correct" way to do this, your DLookUp methodology is a rather "beginner" way to accomplish this.
Assuming the [Course] field is a unique value, then you would need multiple DLookUps for each of the remaining fields:
Code=DLookUp("[Code]","CourseData","[Course]='" & TheSelectedCourse & "'")
Teacher=DLookUp("[Teacher]","CourseData","[Course]='" & TheSelectedCourse & "'")
Period=DLookUp("[Period]","CourseData","[Course]='" & TheSelectedCourse & "'")
Room=DLookUp("[Room]","CourseData","[Course]='" & TheSelectedCourse & "'")
that's . . . single-quote double-quote
and . . . double-quote single-quote double-quote
The method CyberLux recommends is to select multiple columns in the RowSource of a course selection combobox and then, on the AfterUpdate of that combobox, use the following:
Maverick Software Design
(847) 864-3600 x2