Which solution did you attempt to use?
tblSales.[Date] Between IIF([Forms]![frmSelect Query]![Frame54]=1; #100/1/1#;
CDate([Forms]![frmSelect Query]![Start])) AND IIF([Forms]![frmSelect
Query]![Frame54]=1; #3999/12/31#; CDate([Forms]![frmSelect]![End]))
IF that does not work, please tell us what you mean by "does not work".
Are you getting a syntax error message?
Are you getting no results?
Are you getting the wrong results?
Date literals in queries should be in the format
yyyy-mm-dd or mm-dd-yyyy
See Allen Browne's article on International Dates in Access at:
http://allenbrowne.com/ser-36.html
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
I'm sorry but it doesn't work, the text boxes [Start] and [End] have short
date format (dd/mm/yyyy, Spain). would I have to change the format to
American style (yyyy/mm/dd) or something similar? I've read something like
that. How would I have to do it?
:
One way if the field you are applying criteria against ALWAYS has a value.
tblSales.{Date] Between IIF([Forms]![frmSelect Query]![Frame54]=1; #100/1/1#;
[Forms]![frmSelect Query]![Start]) AND IIF([Forms]![frmSelect
Query]![Frame54]=1; #3999/12/31#; [Forms]![frmSelect]![End])
If the date field can be null then enter the following into the criteria
[Forms]![frmSelect Query]![Frame54]=1 OR ([tblSales].[Date]
Between [Forms]![frmSelect Query]![Start] AND [Forms]![frmSelect]![End])
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
KARL DEWEY wrote:
Try changing the syntax like this --
IIf([Forms]![frmSelect Query]![Frame54]=1, [Date], ([tblSales].[Date]
Between[Forms]![frmSelect Query]![Start] AND [Forms]![frmSelect]![End])
You should not use Date as a field name due to being a reserved word and may
cause problems.