Solved

clocking on and off

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

757 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

22 Experts available now in Live!

Get 1:1 Help Now