473,221 Members | 2,048 Online

# Storing & Using the Last Read Value

Hi,

I have a table consists which cosists of batch numbers, and assosiated
dates and times..ie the columns are batch, date and time. The data
within the table is not in any particular order.

With a report, I need to calculate and display the difference in date /
times between like batch numbers, ie displaying batch number, start
date & time, finish date & time and duration

Any suggestions on a possible approch would be appreciated

Thank you
Stephen

Aug 5 '06 #1
3 2028
"Stephen" <st*****@ebacuk.demon.co.ukwrote in
Hi,

I have a table consists which cosists of batch numbers, and
assosiated dates and times..ie the columns are batch, date and
time. The data within the table is not in any particular
order.

With a report, I need to calculate and display the difference
in date / times between like batch numbers, ie displaying
batch number, start date & time, finish date & time and
duration

Any suggestions on a possible approch would be appreciated

Thank you
Stephen
When you say "between like batch numbers" do you mean similar
batch numbers or identical batch numbers?

As a general rule, one would use the sorting and grouping
features to group on the common portion of the batch numbers,
then sort on the individual batch numbers within the group, then
on start date./time. Calculating duration of the two fields in
the same row is done using the datediff() function to calculate
the difference between the two, Use the smallest unit of measure
(days, hours, minutes or seconds) that you wish to display, and
format the result to divide by the larger units to make it human
does this formatting.

As to duration of the interval between adjacent start times,
from row to row, this is more difficult and requires some Visual
Basic code in the report, or a complex query that looks up the
previous start time. for the batch.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Aug 5 '06 #2

Bob Quintal wrote:
"Stephen" <st*****@ebacuk.demon.co.ukwrote in
Hi,

I have a table consists which cosists of batch numbers, and
assosiated dates and times..ie the columns are batch, date and
time. The data within the table is not in any particular
order.

With a report, I need to calculate and display the difference
in date / times between like batch numbers, ie displaying
batch number, start date & time, finish date & time and
duration

Any suggestions on a possible approch would be appreciated

Thank you
Stephen
When you say "between like batch numbers" do you mean similar
batch numbers or identical batch numbers?

As a general rule, one would use the sorting and grouping
features to group on the common portion of the batch numbers,
then sort on the individual batch numbers within the group, then
on start date./time. Calculating duration of the two fields in
the same row is done using the datediff() function to calculate
the difference between the two, Use the smallest unit of measure
(days, hours, minutes or seconds) that you wish to display, and
format the result to divide by the larger units to make it human
does this formatting.

As to duration of the interval between adjacent start times,
from row to row, this is more difficult and requires some Visual
Basic code in the report, or a complex query that looks up the
previous start time. for the batch.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com
Hi Bob

"between like batch numbers", this could be a mixure of identical, and
similar numbers...
In the similar case, if the start time was not available for the batch,
then end time of the previous batch would be used..

This probally makes it even more complex than I originally thought, and
therefore only acheived with VB code (any suggestions would be
appriciated)...

I had hoped it was just a case of reading the table once, to create an
orderd list, and then from this list, read the record before and after
inorder to determine the start and finish times..

Best Regards
Stephen

Aug 5 '06 #3
"Stephen" <st*****@ebacuk.demon.co.ukwrote in
>
Bob Quintal wrote:
>"Stephen" <st*****@ebacuk.demon.co.ukwrote in
Hi,

I have a table consists which cosists of batch numbers, and
assosiated dates and times..ie the columns are batch, date
and time. The data within the table is not in any
particular order.

With a report, I need to calculate and display the
difference in date / times between like batch numbers, ie
displaying batch number, start date & time, finish date &
time and duration

Any suggestions on a possible approch would be appreciated

Thank you
Stephen
When you say "between like batch numbers" do you mean similar
batch numbers or identical batch numbers?

As a general rule, one would use the sorting and grouping
features to group on the common portion of the batch numbers,
then sort on the individual batch numbers within the group,
then on start date./time. Calculating duration of the two
fields in the same row is done using the datediff() function
to calculate the difference between the two, Use the smallest
unit of measure (days, hours, minutes or seconds) that you
wish to display, and format the result to divide by the
newsgroup for a sec2dur() function that does this formatting.

As to duration of the interval between adjacent start times,
from row to row, this is more difficult and requires some
Visual Basic code in the report, or a complex query that
looks up the previous start time. for the batch.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Hi Bob

"between like batch numbers", this could be a mixure of
identical, and similar numbers...
In the similar case, if the start time was not available for
the batch, then end time of the previous batch would be used..

This probally makes it even more complex than I originally
thought, and therefore only acheived with VB code (any
suggestions would be appriciated)...

I had hoped it was just a case of reading the table once, to
create an orderd list, and then from this list, read the
record before and after inorder to determine the start and
finish times..

Best Regards
Stephen
May I suggest you fix the data, so that the times are properly
recorded.

If that's not possible, you could investigate using a recordset
in Visual Basic, to write the data to a temporary table. You can
use the .moveprevious and .movenext methods to get your data.

You could also use the report's .recordsetclone to move back and
forward and see the data for the current record.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Aug 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.