Avatar of Ross Wise
Ross Wise
Flag for United States of America asked on

string literal for half-a-second

Is there an acceptable string literal in the VBA (Access 2013) TimeValue function to express fractions of a second?
In this particular case a Half-Second.

TU_HALF_SECOND = TimeValue("00:00:00.5")         ' Type mismatch error

As a work-around I have calculated it mathematically from a value of one-second:

   TU_HALF_SECOND = TimeValue("00:00:01")         '  The smallest (non-zero) literal I have found that works
   TUVal_HALF_SECOND = CDbl(TU_HALF_SECOND)
   
   TUVal_HALF_SECOND = TUVal_ZERO_SECONDS + (TUVal_HALF_SECOND - TUVal_ZERO_SECONDS) / 2  
                                                                      '  Zero seconds obtained via TimeValue("00:00:00")    ::     I'm aware that this may be redundant
   TU_HALF_SECOND = CDate(TUVal_HALF_SECOND)

So this is not an emergency, I'm just curious.
Microsoft AccessVisual Basic ClassicVBA

Avatar of undefined
Last Comment
Gustav Brock

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Jeffrey Coachman

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Gustav Brock

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Ross Wise

ASKER
Thank you both.
Gustav Brock

You are welcome!

/gustav
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23