SQL Query returns strange results

twcaddell

Registered User.
Local time
Today, 03:58
Joined
Apr 8, 2013
Messages
31
I have a complex database app that has a form called from the main form. It requires two inputs: BeginningDate and EndingDate and I use a calendar picker for date selection. Using data assigned to a variable, I build the SQL query in VBA. The result is:

Code:
SELECT [1733_All Print Orders].[Application], Sum([1733_All Print Orders].[TotalImages]) AS SumOfCCPC 
FROM [1733_All Print Orders] 
WHERE [Application] = 'CCPC' AND [StatementDate] >= #9/3/2013# AND [StatementDate] <= #9/30/2013# 
GROUP BY [1733_All Print Orders];[Application]

[1733_All Print Orders] is a defined query that combines 4 tables together and there are data that falls within the dates for CCPC. But the query returns no records.

I pasted the query to the query builder and using different combinations, I isolated that the [StatementDate] >= #9/3/2013# portion is what returns no records

To complicate matters even worse, prior to today, it worked. I made some adds and changes to another area of the application, but did not touch this code.

Does anyone have any ideas?

TC:banghead:
 
Maybe it is a typo else the group by section is wrong.
GROUP BY [1733_All Print Orders];[Application]
Have you tried the Between operator instead of >= and <=?

[StatementDate] Between #9/3/2013# AND #9/30/2013#
Are you sure that the result from the 4 tables for the field [StatementDate] is a date type and not text looking as date?
 

Users who are viewing this thread

Back
Top Bottom