I am trying to run a parameter query to return results where one of the fields (TotalHours) is greater than or equal to the parameter. If I run the query without the parameter, it gives the expected values, but when I run it with the parameter, it is returning only some of the records, but they have nothing to do with the parameter value--some of them are above the value, some below, and some records that should be returned are not.
I tried removing the ">=___" from the parameter prompt in case one of them was a reserved character, but it made no difference.
Any clue why this is happening?
Is this a WHERE, HAVING, GROUP BY problem? In the Access query design window, you cannot group by only one field if you show the Totals row; you have to have a value in that row for every field, and the default is GROUP BY. When troubleshooting another query, a member here told me I didn't have to do all those GROUP BYs, but I don't understand how you cannot if you use the Totals row in the query design window. This has made me really confused about the use of GROUP BY.
I even tried the query using GROUP BY on all the fields with
>=[Student hours >=___ hours since last test] in the criteria field for TotalHours (which results in a HAVING clause instead of a WHERE clause) with no joy.
SQL is hard
Thanks.
Code:
SELECT qryStudentTotalHoursSinceLastTest.StudentID, qryStudentTotalHoursSinceLastTest.FirstName, qryStudentTotalHoursSinceLastTest.LastName, qryStudentTotalHoursSinceLastTest.TotalHours, qryStudentTotalHoursSinceLastTest.LastOfTestDate
FROM qryStudentTotalHoursSinceLastTest
WHERE (((qryStudentTotalHoursSinceLastTest.TotalHours)>=[Student hours >=___ hours since last test]));
Any clue why this is happening?
Is this a WHERE, HAVING, GROUP BY problem? In the Access query design window, you cannot group by only one field if you show the Totals row; you have to have a value in that row for every field, and the default is GROUP BY. When troubleshooting another query, a member here told me I didn't have to do all those GROUP BYs, but I don't understand how you cannot if you use the Totals row in the query design window. This has made me really confused about the use of GROUP BY.
I even tried the query using GROUP BY on all the fields with
>=[Student hours >=___ hours since last test] in the criteria field for TotalHours (which results in a HAVING clause instead of a WHERE clause) with no joy.
SQL is hard

Thanks.