select with short date from database with long date

  • Thread starter Thread starter Randy Hartwick
  • Start date Start date
R

Randy Hartwick

I have a database that stores information in a longdate
format (including time). The query allows the user to
enter the short date (no time) for selection. The query
does not return all records within the dates identified in
the selection criteria. I believe it is because the
current time is being added to the input date. So what I
believe I need to do is either strip just the date in the
selection criteria or force the selection date criteria
time to be 00:00 for the beginning date and 24:00 for the
ending date. But I can't figure out how to accomplish
either of these tasks.

Any suggestions would be appreciated.
 
I have a database that stores information in a longdate
format (including time).

To be more precise, your database stores a Double Float number, a
count of days and fractions of a day since midnight, December 30,
1899. The fact that you're *displaying* it using a particular format
is irrelevant.
The query allows the user to
enter the short date (no time) for selection. The query
does not return all records within the dates identified in
the selection criteria. I believe it is because the
current time is being added to the input date. So what I
believe I need to do is either strip just the date in the
selection criteria or force the selection date criteria
time to be 00:00 for the beginning date and 24:00 for the
ending date. But I can't figure out how to accomplish
either of these tasks.

Your analysis is exactly correct - #12/20/2003 11:19:18# is in fact
greater than #12/20/2003#.

The criterion I use to handle this is

[Datefield] >= CDate([Enter start date:]) AND [datefield] <
DateAdd("d", 1, CDate([Enter end date:]))
 
Back
Top