Help with SQl error in Access

weilerdo

Registered User.
Local time
Today, 15:11
Joined
Apr 21, 2005
Messages
109
Does anyone know were my error is or of a way to query a table to find the number of calls from 8pm to 7 am for the whole week.

(Error Message)
Syntax Error (Missing Operator) in query expression

SELECT [Half Hour Calls].DateTime, [Half Hour Calls].SumOfCallsOfferedHalf
FROM [Half Hour Calls]
GROUP BY [Half Hour Calls].DateTime, [Half Hour Calls].SumOfCallsOfferedHalf
WHERE ((([Half Hour Calls].DateTime)>=([forms]![Shifts]![Wed] & " 8:00:00 PM") And ([Half Hour Calls].DateTime)<=([forms]![Shifts]![Thurs] & "7:00:00 AM")))
 
Criteria enumerations on grouped fields following the [GROUP BY clause must use HAVING, not WHERE. Also, to ensure not to get an expression too complex error, enclose the form field expressions in the CDate function, like so:

SELECT [Half Hour Calls].DateTime, [Half Hour Calls].SumOfCallsOfferedHalf
FROM [Half Hour Calls]
GROUP BY [Half Hour Calls].DateTime, [Half Hour Calls].SumOfCallsOfferedHalf
HAVING [Half Hour Calls].DateTime>=CDate([Forms]![Shifts]![Wed] & ' 8:00:00 PM') And [Half Hour Calls].DateTime<=CDate([Forms]![Shifts]![Thurs] & ' 7:00:00 AM');
 
Thank you So Much

Thank you so much ByteMyzer, that worked great. It was the whole CDATE thing thaqt made al the difference. :D
 
Last edited:

Users who are viewing this thread

Back
Top Bottom