[AccessD] Losing 3ms on date insert?
Gustav Brock
gustav at cactus.dk
Wed Nov 21 12:44:06 CST 2018
Hi Rayn
Maybe you should check those values retrieved from Excel. The format has no importance, it is the value that counts, and Access will not natively reveal a millisecond difference.
You can check if milliseconds are present with this code:
<code>
Public Const MillisecondsPerSecond As Long = 10 ^ 3
Public Const MicrosecondsPerSecond As Long = 10 ^ 6
Public Const NanosecondsPerSecond As Long = 10 ^ 9
Public Const MinutesPerDay As Long = HoursPerDay * MinutesPerHour
Public Const SecondsPerHour As Long = MinutesPerHour * SecondsPerMinute
Public Const SecondsPerDay As Long = HoursPerDay * SecondsPerHour
Public Const MillisecondsPerMinute As Long = SecondsPerMinute * MillisecondsPerSecond
Public Const MillisecondsPerDay As Long = SecondsPerDay * MillisecondsPerSecond
' Returns the millisecond part from Date1.
'
' 2016-09-15. Gustav Brock, Cactus Data ApS, CPH.
'
Public Function Millisecond( _
ByVal Date1 As Date) _
As Integer
Dim Milliseconds As Integer
' Remove date part from date/time value and extract count of milliseconds.
' Note the use of CDec() to prevent bit errors for very large date values.
Milliseconds = Abs(Date1 - CDec(Fix(Date1))) * MillisecondsPerDay Mod MillisecondsPerSecond
Millisecond = Milliseconds
End Function
</code>
If that is the case, round the values before storing them using my function posted before.
/gustav
More information about the AccessD
mailing list