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

Gustav Brock Gustav at cactus.dk
Mon Aug 31 15:24:42 CDT 2009


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






More information about the AccessD mailing list