Clock in/clock out, add up hours

tavys
tavys used Ask the Experts™
on
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?

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
This site is a great Access resource. Try the search link and type "Time Clock"

http://www.mvps.org/access/index.html

Commented:
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



Author

Commented:
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.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
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.

Commented:

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)
PAQ'd and points refunded (although tokerblue's resource was great, it appears the challenge for this questioner was in using VB to get from point A to Point B and the resources didn't address the VB aspect at least the ones I checked that I thought would fit.  Also, questioner came back to clarify and wasn't answered)

SpideyMod
Community Support Moderator @Experts Exchange

Author

Commented:
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.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial