This query is typed incorrectly or is too complex to be evaluated.

  • Thread starter Thread starter GWB
  • Start date Start date
G

GWB

I'm trying to retrieve records with a start date and stop date criteria. The
format of the Date column in my table is general date.
I dont understand why it wont work


FROM [Spreadcheck on this laptop]
WHERE (((([Spreadcheck on this laptop].Date)>=[Start Date] AND [Spreadcheck
on this laptop].Date)<[Stop Date]));
 
OK - I guess the brackets are the problem.... it work now, but asks for the
start time and stop time twice! Thanks for any help
 
I surprised it gets even that far without a SELECT statement.

If you have an issue with a query, it is customary to post all the SQL.

--
Duane Hookom
Microsoft Access MVP


GWB said:
OK - I guess the brackets are the problem.... it work now, but asks for the
start time and stop time twice! Thanks for any help

GWB said:
I'm trying to retrieve records with a start date and stop date criteria. The
format of the Date column in my table is general date.
I dont understand why it wont work


FROM [Spreadcheck on this laptop]
WHERE (((([Spreadcheck on this laptop].Date)>=[Start Date] AND [Spreadcheck
on this laptop].Date)<[Stop Date]));
 
OK - I guess the brackets are the problem.... it work now, but asks for the
start time and stop time twice! Thanks for any help

Please copy and paste the complete SQL of the query.

You may need to use its Parameters; you should CERTAINLY rename the field Date
since that's a reserved word; and you should probably use a Form to collect
the parameters rather than a prompt like [Enter date]. To do so create an
unbound form (let's call it frmCrit) with textboxes txtStart and txtEnd; your
query would then be

SELECT <whatever you want to see>
FROM [Spreadcheck on this laptop]
WHERE (((([Spreadcheck on this laptop].[renamedDate]) >=
[Forms]![frmCrit]![txtStart] AND [Spreadcheck on this laptop].[renamedDate]) <
DateAdd("d", 1, [Forms]![frmCrit]![txtEnd])));

The DateAdd bit ensures that if the Date field contains a time portion you get
the data from the last day of the range.
 
Back
Top