Solved

clocking on and off

Posted on 2004-08-17
4
186 Views
Last Modified: 2013-12-25
I want to create a form thatw ill me to code in a clock-on and clock-off system and then calculate the expired time bewteen clocking on and off.
0
Comment
Question by:vbhel1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 18

Accepted Solution

by:
JR2003 earned 250 total points
ID: 11829349
Take a new form add 2 buttons, 2 textboxes and a label.
Paste in the following code

Option Explicit
Private dtClockOn As Date
Private dtClockOff As Date
Private sglTimeWorked As Single

Private Sub Command1_Click()
    'Clock On
    dtClockOn = Now()
    Text1.Text = Format(dtClockOn, "hh:mm:ss")
End Sub

Private Sub Command2_Click()

    'Clock Off
    dtClockOff = Now()
    Text2.Text = Format(dtClockOff, "hh:mm:ss")
    sglTimeWorked = dtClockOff - dtClockOn + 1
    Label1.Caption = IIf(sglTimeWorked >= 1, Fix(sglTimeWorked) & " Days ", "") & Format(sglTimeWorked, " hh:mm:ss")
End Sub

Private Sub Form_Load()

    Command1.Caption = "Clock On"
    Command2.Caption = "Clock Off"

End Sub
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month5 days, 13 hours left to enroll

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question