How do i Do this

J

James

Ok, I have a access database(from ISA Server)

It has a username and a time in HH:MM:SS format.
It logs the time when the user goes on the internet, and when they aren't
browsing no times are logged.

What I want to do is find out how long they are one for. For example say
the first time i have logged for them is at 8am and the last time i have
logged for them is 5pm.

Now from 8 to 5 is 9 hours, obviously they weren't nescesarily online for 9
hours. I want to total the time they were online, BUT if there is a gap of
more then 5 minutes between logged time, i don't want to count that
time....make sense? What type of code what I need to do to acomplish
this???

Thanks


Heres basically what i'm trying to do, but don't know how to code.

START
Set Time1= currentrecord.time
go to next record
Set Time 2 = currentrecord.time
Set Start time to Time1
Set End time to Time2

Do While Time1 + 5 > Time2

(Go to next record
Set Endtime = Time2
Set Time1=Time2
Set Time2 = Currentrecord.time)

Else
Set Sum = Endtime - Start Time
Set Total = Total + Sum
Set Start Time = Time2
Go to next record
Set Time1 = Time2
Set Time 2 = CurrentRecord.time

If End of Records
Display Sum

Else Go back to first Do While

I know this is rough, but its basically what i want to do, could anyone help
me code this for acces, I've never used access, so I really don't know where
to start....thanks
 
J

John Vinson

Ok, I have a access database(from ISA Server)

It has a username and a time in HH:MM:SS format.
It logs the time when the user goes on the internet, and when they aren't
browsing no times are logged.

What I want to do is find out how long they are one for. For example say
the first time i have logged for them is at 8am and the last time i have
logged for them is 5pm.

Now from 8 to 5 is 9 hours, obviously they weren't nescesarily online for 9
hours. I want to total the time they were online, BUT if there is a gap of
more then 5 minutes between logged time, i don't want to count that
time....make sense? What type of code what I need to do to acomplish
this???

No code at all, and no looping. <g>

If each record has a StartTime and EndTime field, create a Query based
on your table. Add two calculated fields:

LogDay: DateValue([StartTime])
Duration: DateDiff("n", [StartTime], [EndTime])

This will give the length of time represented by each record in
minutes. Create a Totals query grouping by the username and LogDay,
and Sum the duration; this will give you the total number of minutes
logged on.

If you *don't* have the EndTime, I don't see how you can get a
meaningful sum at all: if I connect to the internet at 6:52pm I might
check my email and be off at 6:54, or I might get on the newsgroups
and still be plugging away at 8 - even if the next time I connect is
8:10. How could you tell?
 

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

Similar Threads


Top