Combo box selection for query

  • Thread starter Thread starter jdreece
  • Start date Start date
J

jdreece

Guest
I'm new at Access 03. I have a combobox that is sourced by a table, Rowsource property is:

SELECT Classes.TableID, Classes.ClassID FROM Classes;

The name of my combobox is "ClassCombo".

I'm trying to generate a report based on my combobox selection, but I can't reference the value of the selection. The query tied to my report has the following SQL:

SELECT ClassesForInstructors.ClassID, Instructors.InstructorID, Instructors.FirstName, Instructors.LastName
FROM Instructors INNER JOIN ClassesForInstructors ON Instructors.InstructorID = ClassesForInstructors.InstructorID
WHERE (((ClassesForInstructors.ClassID)="[Forms]![School]![ClassCombo]"));

I'm trying to grab the "ClassCombo" value as input to my query, but it's not working. What am I doing wrong?

Thanks!
 
You need to remove the quotations from around the [Forms]![School]![ClassCombo], otherwise you are asking the SQL to return all records where ClassID equals a string of [Forms]![School]![ClassCombo] rather than taking the value from the combobox.
 
Thanks! Seem to work!
 

Users who are viewing this thread

Back
Top Bottom