Link to home
Start Free TrialLog in
Avatar of tavys
tavys

asked on

Clock in/clock out, add up hours

I am very new to Access and am having some trouble with VB programming.  

One of my forms needs to have a clock in and clock out time.  There will be a button to clear these two fields if the user so desires, and another which will do the following:

- subtract start time from end time to find total hours:minutes
- place this total into a total field
- increment another field by +1 (for each in/out calculated)
- clear the in/out fields for the next use

I'm not really sure where to start.  I'm a C guy, and VB is confusing me.  There's no way to implement C into Access, is there?

Avatar of tokerblue
tokerblue

This site is a great Access resource. Try the search link and type "Time Clock"

http://www.mvps.org/access/index.html
Are the users going to key in their time, or are you going to use a button for it.  Should be pretty easy to do in code, but need more info...tables, fields, control names



Avatar of tavys

ASKER

Like this

(clock in time field)
[clock in button]

(clock out time field)
[clock out button]

(today's hours field)
[add to total button]

(quarterly total hours field)

I have added a column in the table for In, Out, and Today's hours.  I want In and Out to be clock time and the button for each will add that time to their respecfive fields in the table's columns.  The Out button will also convert the total for Today's hours into decimal hours, placing it in the Today's hours field for the user to see.  If they want to add these hours to the running Quarterly total, they click the Add to total button, which will also clear the first three fields.  I'll also want a regular clear button for the In and Out in case they were clicked at the wrong time.

The reason I want decimal hours is only because the time format does not seem to allow times greater than 24 hours, otherwise I would not bother with the conversion.  Is there a built-in function for clock hours to decimal hours, or do I have to do the Hours + Minutes/60 thing myself in code?

Thanks for that mvps.org link, that's a good site.
Avatar of tavys

ASKER

Oh, control names.  These are all in a table called "Student list":

"Clock in" in table, medium time format
("Clock in" in form)
[Clock in button] [Clear clock in]

"Clock out" in table, medium time format
("Clock out" time field in form)
[Clock out button] [Clear clock out]

"Visit time" in table, long integer format
("Visit time" number field in form)
[Add to total button]

"Shop hours" in table, long integer format
("Shop hours" number field in form)

"Shop visits" in table, long integer format
("Shop visits" number field in form)


I've tried using the Expression builder in the "On Click" portion of the button properties to do something like "On Click = [Clock in] = Now()" but that doesn't seem to work.

The Shop visits will increment +1 for each Visit time added to the total Shop hours.

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - Answered by: tokerblue  
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
ASKER CERTIFIED SOLUTION
Avatar of SpideyMod
SpideyMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tavys

ASKER

Let's just say that I had no idea what I was doing at the time.  I've since learned how to use queries to add things up rather than do math inside tables and forms.