Consulting

Results 1 to 2 of 2

Thread: Timer

  1. #1

    Timer

    I am currently very new to the programming world, and help with the following will greatly be appreciated.

    I am currently trying to set up a command button on User Form (A) to call another user Form (B)(<---Which I have accomplished) once here I have 3 label boxes and a command button. Lablebox1 is the time that the button was clicked from Form (A). LabelBox2 will display the time that the command button on Form (B) is clicked. LabelBox 3 will display the difference between the two times in minutes. Once this is obtained, I would like for LableBox3 to send the info gathered back to User Form (A) to LabelBox4.If I can get this little problem behind me I believe that I can accomplish the rest.

    ***Note. The times that will be use will quite freqently will be from 11:59 PM to 12:01AM(NextDay)
    Thanks for any help.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    On Userform2

    Private InvokedAt As Date
    
    Private Sub cmdOK_Click()
        Label2.Caption = Format(Now)
        Label3.Caption = Format(Now - InvokedAt, "hh:mm:ss")
        UserForm1.Label4.Caption = Label3.Caption
    End Sub
    
    Private Sub UserForm_Activate()
    InvokedAt = Now
        Label1.Caption = InvokedAt
    End Sub
    Last edited by Aussiebear; 04-06-2023 at 09:34 PM. Reason: Adjusted the code tags
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •