Date range "Between X And X" not working when passed from a from

J

JoeG

I've been using "BETWEEN #xxx/xxx/xxxxx# AND #xxx/xxx/xxxxx#" sucessfully as
long as I types the dates directly into the query. When I try to pass the
dates to the query from a form I errors, if query contains the # symbols, and
when I exclude them, no errors BUT no data gets returned.

I'm thinking the query doesn't see the dates on the form as dates but as text.
So far I have not been able to verify this or get the results to return an
data.

Any suggestion would be greatly appreciated.
 
J

Jeff L

Are you using the correct syntax for refering to a field on a form in
your criteria?
Between Forms!YourFormName!StartDate And Forms!YourFormName!EndDate
 
J

John Spencer

Also, try wrapping the Forms!YourFormName!StartDate with CDate so that
Access will know what is being passed.

Better yet use the Parameter dialog and declare the types.

In the query grid design view, select Query: Parameters from the menu
Type in [Forms]![YourFormName]![YourcontrolName] and select Date/Time for
the type
 
Top