Solved

clocking on and off

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How does CurrentUser work? 10 41
VBA Shell can't Find Word document 11 127
Help me. 3 69
RUNRMTCMD from AS/400 13 88
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

735 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