infomania
Programmer
- Oct 27, 2002
- 148
I am trying to filter a query using a date value from a form.
I keep getting an error: "The expression you entered has an invalid date value." and points to the WHERE criteria:
#[Forms]![fmReportSelection]![fmReportSelectionSubform].[Form]![txFlag3]#
The unbound form field (txFlag3) has a format of ShortDate and the value in the field is 7/22/2004.
When I use #7/22/2004# as the WHERE criteria, the query returns 9 rows of data (correct).
The whole SQL looks like this (used for a chart report):
SELECT
qryWoodsArrivalTime.HOUR,
Sum(qryWoodsArrivalTime.CountOfTRACKING_DATA_ID) AS NBR_TRUCKS,
qryWoodsArrivalTime.SUPPLIER_NAME,
qryWoodsArrivalTime.DATE_LOADED
FROM qryWoodsArrivalTime
GROUP BY
qryWoodsArrivalTime.HOUR,
qryWoodsArrivalTime.SUPPLIER_NAME,
qryWoodsArrivalTime.DATE_LOADED
HAVING (((qryWoodsArrivalTime.SUPPLIER_NAME)=[Forms]![fmReportSelection]![fmReportSelectionSubform].[Form]![txFlag1]) AND ((qryWoodsArrivalTime.DATE_LOADED)=#[Forms]![fmReportSelection]![fmReportSelectionSubform].[Form]![txFlag3]#));
How can I resolve this? I tried using DateValue() around the Form field but this produced no results (and no errors).
If I can resolve this I want to move on to a a Between WHERE critera to bracket two date field on the form.
Thanks, in advance.
Infomania
I keep getting an error: "The expression you entered has an invalid date value." and points to the WHERE criteria:
#[Forms]![fmReportSelection]![fmReportSelectionSubform].[Form]![txFlag3]#
The unbound form field (txFlag3) has a format of ShortDate and the value in the field is 7/22/2004.
When I use #7/22/2004# as the WHERE criteria, the query returns 9 rows of data (correct).
The whole SQL looks like this (used for a chart report):
SELECT
qryWoodsArrivalTime.HOUR,
Sum(qryWoodsArrivalTime.CountOfTRACKING_DATA_ID) AS NBR_TRUCKS,
qryWoodsArrivalTime.SUPPLIER_NAME,
qryWoodsArrivalTime.DATE_LOADED
FROM qryWoodsArrivalTime
GROUP BY
qryWoodsArrivalTime.HOUR,
qryWoodsArrivalTime.SUPPLIER_NAME,
qryWoodsArrivalTime.DATE_LOADED
HAVING (((qryWoodsArrivalTime.SUPPLIER_NAME)=[Forms]![fmReportSelection]![fmReportSelectionSubform].[Form]![txFlag1]) AND ((qryWoodsArrivalTime.DATE_LOADED)=#[Forms]![fmReportSelection]![fmReportSelectionSubform].[Form]![txFlag3]#));
How can I resolve this? I tried using DateValue() around the Form field but this produced no results (and no errors).
If I can resolve this I want to move on to a a Between WHERE critera to bracket two date field on the form.
Thanks, in advance.
Infomania