Adapting this combo box query problem

dragginthru

HMTL & CCS expert
Local time
Today, 00:41
Joined
Sep 21, 2005
Messages
63
OK ive spent half the day on this now and am none the wiser.

In an earlier thread i was shown how to make a 2nd combo box use the value selected in the first to narrow down a range of dates for courses.

The example works fine and I understand it with the following two select queries:


tables etc for WORKING example:

tbl_training_courses
===============
CourseID
course_name
(other fields but not needed here)

tbl_course_dates
=============
course_name
course_date

Combo Box A
==========
SELECT tbl_training_courses.course_name FROM tbl_training_courses
ORDER BY [course_name];

Combo Box B
SELECT tbl_course_dates.course_name, tbl_course_dates.course_date FROM tbl_course_dates
WHERE tbl_course_dates.course_name=Forms!Form1!A
ORDER BY tbl_course_dates.Course_Date;




For my NON WORKING one, the difference is that the link in the tables is the CourseID as opposed to the course_title field. However just switching it doesnt work as the course_title is required to show in the first combo box, not the arbitrary courseID.

There is a form used to input new course dates, and when you have selected a course and added a date to the subform, it writes the CourseID and course_date into the tbl_course_dates table.


Here are my tables:

tbl_training_courses
===============
CourseID
course_name
(other fields but not needed here)

tbl_course_dates
=============
courseID
course_date

Could someone show me how to modify the above queries so that they will work with my fields please?
 
Anyone help?

Ive tried to build the SQL myself but i just get blank form fields so it must be wrong :(

SELECT tbl_course_dates.course_date
FROM tbl_course_dates
WHERE tbl_course_dates.courseID=Forms![Training Record]!course_title_combo
ORDER BY tbl_course_dates.course_date
 

Users who are viewing this thread

Back
Top Bottom