Milseconds on VBA

mfaqueiroz

Registered User.
Local time
Today, 09:06
Joined
Sep 30, 2015
Messages
125
Hei everyone!!!
I have one field with my date in this format : dd-mm-yyyy hh:mm:ss
and other field with my milliseconds.

I use a lot of vba comparisons with date, like see all registers between
01-01-2015 10:10:10 ms=100 and 01-10-2015 10:10:15 ms=200

Do you know how can I compare the two fields( milliseconds+date) at the same time?

Thhank you all!!
I wish you a great day :)!!
 
Last edited:
There is no provision for milliseconds in vba.

That is, you cannot have 10:10:15.2
 
you can format you fields as string then convert to number:

Val(Format([dateField],"yyyymmddhhmmss") & Format(nz([msField],0),"000"))

on your sql

where Val(Format([dateField],"yyyymmddhhmmss") & Format(nz([msField],0),"000")) Between 201501011010100 And 20150110101015200
 
I would write a query that just adds the date and the ms together
Code:
TimeMS: MyDateField + MyMSField/1000
Other queries can then filter, sort, and search on that TimeMS field.

I would always avoid converting to a string and then back to a number.

Also, in formatting a date, use "n" for minutes, since "m" is already used for Month.

Hope this helps,
 

Users who are viewing this thread

Back
Top Bottom