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

  • Thread starter Thread starter JoeG
  • Start date Start date
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.
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top