NT4 date comparison problem with Access 2000

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an issue with a few NT4 machines, and not on all NT4 machines which is
driving me a bit nuts. Incidently it works right on all Windows 2000 machines.

If CDate(txtPADateRangeEndDate.Value) < CDate(txtPADateRangeStartDate.Value)
Then
'display message that end date can't be before start date.

On some NT4 machines if the start date is 10/20/2004 and the end date is
12/20/2004 the comparison will fail. It says the end date is less than the
start date. In one case the end date is 12/31/2999 (in our use this means
there is no end date set at this point) and that failed. The short date on
that NT4 machine was set to M/d/YY and as a result it truncated 2999 to 1999
and that is less than 10/20/2004. I set the short date to M/d/YYYY and that
machine has run it correctly since. The machines I'm still fighting have the
four digit year setting in place. All of the machines have NT4 SP6.

I have no control on service packs installed on these machines so I need a
solution that will work on any machine, NT4, Win2000 and WinXP, without
installing a service pack or dll.

Any idea on a fix or workaround?

Thanks
Mark
 
Hi,


Maybe it is nice to differentiate the STORED VALUE in a date_time field
and the FORMAT representation of the value, in a string. If you compare two
date_time values, the regional setting does not matter. If you have to use
CDate, around your control, it is probably because the controls are not
associated to a date_time field (or are unbound control). When interacting
with the end user, the "string" is (tried to be) decoded using the Regional
Setting, which is assumed to be the preferred format of the user. You can
instruct your end users to use a four digit year. In this particular case,
it may be preferable to use a NULL rather than a made-up date, if there is
no end date yet known.

Hoping it may help,
Vanderghast, Access MVP
 

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