Link to home
Start Free TrialLog in
Avatar of Bob Schneider
Bob SchneiderFlag for United States of America

asked on

Comparing times without dates using vb6

I'm trying to determine if the time at which a button is clicked is greater than a time that I only have hh:mm:ss for in vb6.  Here is what I am trying but it is not working.  Any help would be much appreciated.


If Now > Date & " " & ConvertToMinutes(sngStartTime + sngThisRaceDelay) Then 

Open in new window

Here is what they return individually and when I compare them.  

4/18/2023 10:53:42 AM, 4/18/2023 9:00:05.0

False


What is a good way to perform this task?


Thank you!

ASKER CERTIFIED SOLUTION
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob Schneider

ASKER

Actually, I have been tinkering with it and keep getting a type mismatch error.  Here is what I tried last:
        
        sRaceStart = ConvertToMinutes(sngStartTime + sngThisRaceDelay)
        sTimeNow = TimeValue(Now())
        
        'make sure this race has started
        If DateDiff("s", sTimeNow, sRaceStart) > 0 Then

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I’m glad I was able to help.

If you expand the “Full Biography" section of my profile you’ll find links to some articles I’ve written that may interest you, including a new one concerning Easy Ways to do Hard Things.

Marty - Microsoft MVP 2009 to 2017
        Experts Exchange Most Valuable Expert (MVE) 2015 and 2017
        Experts Exchange Distinguished Expert in Excel 2018, 2021, 2022
        Experts Exchange Distinguished Expert in Microsoft Office 2022
        Experts Exchange Distinguished Expert in VBA 2022
        Experts Exchange Top Expert VBA 2018 to 2022
        Experts Exchange Top Expert Visual Basic Classic 2012 to 2022