[AccessD] Losing 3ms on date insert?

Bill Benson bensonforums at gmail.com
Fri Nov 23 21:11:59 CST 2018


Maybe irrelevant but are you using the .value property of an Excel range or
Value2? I think the latter has more precision, but unfortunately .Value is
all you can copy into an array, as it is the default property? Just a
hunch, not tested.

On Wed, Nov 21, 2018, 1:45 PM Gustav Brock <gustav at cactus.dk wrote:

> 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
> --
> 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