Time Card creation

H

Harriet

I found something in MS Access and don't know how I need to proceed as I am
trying to create a time card database for a group of associates to log in,
log out for lunch, log in for lunch, log out, without them entering the time
but a system generated time be used (to keep everyone honest).

I also need it to calculate the hours for the day that the associate worked.

Here is what I found in 'help': You can also store the date and time values
as numbers when you plan to perform calculations on the date and time data.
For example, you can calculate a total number of hours worked (a time card),
or the age of an invoice. For more information about how to calculate date
values, see the article on the Date function.

Can anyone help me to proceed?

Harriet
 
K

Keven Denen

I found something in MS Access and don't know how I need to proceed as I am
trying to create a time card database for a group of associates to log in,
log out for lunch, log in for lunch, log out, without them entering the time
but a system generated time be used (to keep everyone honest).

I also need it to calculate the hours for the day that the associate worked.

Here is what I found in 'help': You can also store the date and time values
as numbers when you plan to perform calculations on the date and time data.
For example, you can calculate a total number of hours worked (a time card),
or the age of an invoice. For more information about how to calculate date
values, see the article on the Date function.

Can anyone help me to proceed?

Harriet

Basically this is telling you that you can treat your dates as numbers
and use them in calculations (because in the background, the dates are
stored as numbers). If you want to find the total time worked for that
day, just subtract the login from the logoutlunch, subtract loginlunch
from logout and add the resulting numbers together.

Something along the lines of:
Format((logoutlunch - login) + (logout - loginlunch), "hh:nn")

Keven Denen
 
K

Keven Denen

Basically this is telling you that you can treat your dates as numbers
and use them in calculations (because in the background, the dates are
stored as numbers). If you want to find the total time worked for that
day, just subtract the login from the logoutlunch, subtract loginlunch
from logout and add the resulting numbers together.

Something along the lines of:
Format((logoutlunch - login) + (logout - loginlunch), "hh:nn")

Keven Denen- Hide quoted text -

- Show quoted text -

Also, check out the Now() function. It gives you the current date and
time.

One thing you will need to account for is if the users doesn't take a
lunch break. You'll need to use some If/Then logic to adjust the
formula I wrote above in this case.

Keven Denen
 
A

Arvin Meyer [MVP]

The Now() funtion, effectively timestamps a record, so what you might need to
do is to have your user log in, then either use that login, or have him
select his name from a list, then select whether he/she is doing a login or
out for which time period. I'd use check boxes and an option group, then
click OK. The OK button will note the system time and place that time in a
hidden textbox on the form. You can also use the AfterUpdate event of the
login/out option group, but that won't give your users a chance to fix a
mistake.

So, some simple code to do the timestamp might be:

Sub cmdOK_Click()
Me.txtLoginChoice = Me.optLogin_Out
Me.txtTime = Now()
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top