Solved

clocking on and off

Posted on 2004-08-17
4
182 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now