PDA

Click to See Complete Forum and Search --> : Date/Calculation


CLevent21
Feb 23rd, 2000, 04:07 AM
Hey People, I am trying to write this VBA script in Access, perferable in a table if possible otherwise a form. I want to keep track of people who log onto a system by DateIn, TimeIN, DateOut, TimeOut. Then I will have a Total that will accumulate the the total number of hours logged onto the system. I am running into problems when someone logs on like this 2/15/00 1:00AM - 2/17/00 3:00AM. Instead of getting 50 hrs I get two hrs in the total Hours. I would appreciate any help, thanx in advance

bsmith
Feb 23rd, 2000, 04:15 AM
If you store the Date and Time in the same field you can then take the DateDiff function to calculate the difference between your two dates in hours.

JHausmann
Feb 23rd, 2000, 05:30 AM
Add dayhrs to whatever you're using to calculate the total hours now:

dayhrs= 24 * (cint(startdate) - cint(stopdate))

date fields are floats, the integer portion represents dates, the decimal portion time. By converting to integer, you're discarding the time portion.