Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query by form, multiple criteria

Status
Not open for further replies.

sxysiv

Technical User
Feb 2, 2005
2
US
Hello, I have a problem with returning records when I try to run a query by form. I have a form that provides my search criteria with two buttons that run a Query-to-table or a Query-to-report. Pressing either of these buttons will return an empty table or an empty report, when there should be data showing up.

My first unbound criteria is picked from a combo box, the value is named "QuarterName." (An example of a possible value is: MAT Internship)

The next three unbound criteria are blank, user fill-in boxes with the quarter date, named "Quarter 1,""Quarter2," or "Quarter3." (for example, one would enter a value like this: 200451 --> which means the Autumn quarter of the 2004-5 school year)

I need to search for a quarter name, and the specific dates those quarters where taken in; as in, searching for people that have taken the "MAT Internship" quarter, in 200451, 200452, or 200453. So, this is a QuarterName AND (3 OR options).

Here is my query setup in SQL:
------
SELECT StudentQuarters.quarter_name, StudentQuarters.quarter, Students.SPU_ID, Students.SSN, Students.program, Students.first_name, Students.middle_name, Students.last_name
FROM Students INNER JOIN StudentQuarters ON Students.SPU_ID = StudentQuarters.SPU_ID
WHERE (((StudentQuarters.quarter_name)=[Forms]![frm_Student_by_quarter]![QuarterName]) AND ((StudentQuarters.quarter)=[Forms]![frm_Student_by_quarter]![Quarter1] Or (StudentQuarters.quarter)=[Forms]![frm_Student_by_quarter]![Quarter2] Or (StudentQuarters.quarter)=[Forms]![frm_Student_by_quarter]![Quarter3]));
----
Can someone please tell me why the query will run, but show me no records at the end, when I know for sure that there is data that needs to show up?

Thank you so much in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top