|
-
Jul 27th, 2006, 03:31 PM
#1
Thread Starter
New Member
Calculate Elasped EndTime To Next Record StartTime field
This is my first post and would like some help on making a table from an existing table that has PN, StartTime, EndTime fields. I am trying to find the calculated time from one record's end time to the next records StartTime. Any examples or help will be appreciated.
Joe
Last edited by JoeAtBell; Aug 11th, 2006 at 08:08 AM.
Reason: deleting question to remove space
-
Jul 27th, 2006, 03:37 PM
#2
Re: Calculate Elasped EndTime To Next Record StartTime field
How do you store Start/End time?
-
Jul 27th, 2006, 03:38 PM
#3
Re: Calculate Elasped EndTime To Next Record StartTime field
First post!?? its says 2! lol j/k
what are you doing this in? Access?
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 28th, 2006, 08:27 AM
#4
Thread Starter
New Member
Re: Calculate Elasped EndTime To Next Record StartTime field
I am working with MS-Access 2003 and the the data is in a table like :
PN is Text, StartDAte is DateTime, EndDAte is DateTime.
-
Jul 28th, 2006, 08:35 AM
#5
Re: Calculate Elasped EndTime To Next Record StartTime field
well it depends on what u want to have as elapsed time...
Hours? days? mins? all??
here is a simple sample...
VB Code:
SELECT Table5.PN, Table5.StartDate, Table5.EndDate, [EndDate]-[StartDate] AS Elapsed INTO ElapsedTime
FROM Table5;
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 28th, 2006, 08:46 AM
#6
Thread Starter
New Member
Re: Calculate Elasped EndTime To Next Record StartTime field
Thanks for the sample, but it looks like this would look at the current row only. My real problem is that the Table is sorted by StartDate and I am trying to subtact the StartTime form the PREVIOUS records EndTime. Or the EndTime from the current record the the StartTime of the NEXT record.
Joe
-
Jul 28th, 2006, 11:39 AM
#7
Thread Starter
New Member
Re: Calculate Elasped EndTime To Next Record StartTime field
Start and End times are in a MS-Access 2003 table. both are formated datetime
-
Jul 28th, 2006, 11:41 AM
#8
Thread Starter
New Member
Re: Calculate Elasped EndTime To Next Record StartTime field
Yes I'm using MS-Access 2003 but I'm trying to use a Module in VBA for this action.
-
Jul 28th, 2006, 04:50 PM
#9
Re: Calculate Elasped EndTime To Next Record StartTime field
Static's code would create a table named ElapsedTime with all records with the elapsed time from start to end for that record.
If you wanted end of that record to start of the next record interval, create a recordset of * and walk it from the first record to the last record, saving the current record's end time in a variable, move to the next record, subtract the variable from the current record's start time (this is your "inter-record" time interval), record the current record's end time in the variable ... and repeat till the last record. What you do with the time interval at each step is up to you.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Aug 11th, 2006, 08:11 AM
#10
Thread Starter
New Member
Re: Calculate Elasped EndTime To Next Record StartTime field
thanks for all your help. I bought a couple of new books to read up on VBA and try to incorporate your suggestions.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|