[AccessD] Date and Now (was: NZ question)

Dan Waters dwaters at usinternet.com
Mon Aug 31 15:49:09 CDT 2009


Thanks Gustav - I like the simple stuff!

It's been a few years since I've seen a problem with Date().  But I do
remember that other folks on this list had also seen occasional problems
with Date().

Thanks!
Dan

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Monday, August 31, 2009 3:25 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Date and Now (was: NZ question)

Hi Dan

I cannot verify that finding - actually I have never seen any issue with
Date().

Also, your CurrentDate expression will not work in most of Europe and Asia
because of the US format expression.
If you just want to strip the time part of a date/time value from Now, you
can do it like this:

  CurrentDate = Int(Now)

If you prefer a more elaborate method, use DateSerial:

  datNow = Now
  CurrentDate = DateSerial(Year(datNow), Month(datNow), Day(datNow))

In general, the last method to manipulate or calculate numbers or date/times
should be to revert to string handling.

/gustav


>>> dwaters at usinternet.com 31-08-2009 21:18 >>>
Hi Chester,

I've found that Date() is not reliable from one PC to another.

Use this function instead:
Public Function CurrentDate() As Date
    
    CurrentDate = CDate(DatePart("m", Now()) & "/" & DatePart("d", Now()) &
"/" & DatePart("yyyy", Now()))
    
End Function

Then use:
End_Allocations_Calc: NZ([End_Manual_Allocation_Factors],CurrentDate)

Good Luck!
Dan



-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list