SQL parameters taken from a form

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

We have a form with a "From" Value and a "To" Value.
They are both String fields. For example, from "03-0001"
to "03-0272". The problem is that the query result acts
as if we had "03-0001" - "03-0271" as the from - to
range. Our query specifies "... WHERE [FDEP App#]>=
[Forms]![ArgForm]![FromFld] AND <=[Forms]![ArgForm]!
[ToFld] ... but doesn't get the correct results.

The results look as if we had specified ... "AND <[Forms]!
[ArgForm]![ToFld] ...

However, if literal values are substituted in the SQL,
then the results are OK. Is there some bug in ACCESS 2002
that we are not aware of? Thanks.

PS. The from - to values show up correctly in the Report
Heading.
 
Try:

....
WHERE [FDEP App#] BETWEEN [Forms]![ArgForm]![FromFld]
AND [Forms]![ArgForm]![ToFld]

If you still want to use <= and <= in the SQL String , you must use:

....
WHERE [FDEP App#] >= [Forms]![ArgForm]![FromFld]
AND [FDEP App#] <= [Forms]![ArgForm]![ToFld]
 
Back
Top