Date from Form

  • Thread starter Thread starter galin
  • Start date Start date
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
 
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.
 
Back
Top