Date from Form

G

galin

Hi guys,

I have a form that runs totals when I specify Date Range(...Fro
...To). How do I code my form when user doesn't enter any dates (jus
leave the boxes blank)my form runs all totals for every single day?

Or when a user enters only starting date, how do I code my form t
display the results after the specified date unitl last day?

Thank you in advance
Gali
 
J

John Vinson

Hi guys,

I have a form that runs totals when I specify Date Range(...From
..To). How do I code my form when user doesn't enter any dates (just
leave the boxes blank)my form runs all totals for every single day?

Or when a user enters only starting date, how do I code my form to
display the results after the specified date unitl last day?

You can use a criterion like:

WHERE ([datefield] >= CDate([From:]) OR [From:] IS NULL)
AND ([datefield] <= CDate([To:]) OR [To:] IS NULL)

If the user enters both dates it will get all the data in between; if
they enter only From: they'll get all data since that date; if they
enter only To: they'll get all data prior to that date; if they leave
both blank they'll get all records in the table.
 

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

Top