Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Needed...recordsets

Status
Not open for further replies.

NikosXP

Instructor
Oct 24, 2001
13
0
0
GR
Hi to All...
I have the following Table(Not fixed length)

Table A:

Time Class
-------------
10,12 A
11,2 A
12 B
13 B
14,3 B
15 A
16 C
etc...
And want to produce a more synoptic table with the same info B...

Table B:

LowBound UpperBound Class
---------------------------------
10,12 12 A
12 15 B
15 16 A
16 16 C
etc...

I've tried to find an SQL query , but the prob is that I don't want to group all A's or B's or... together but only if they are continuous(sth like Run Length Encoding)
So I have planned an algorithm to perform the task But I don't know how to write it using recordsets and how can I send the data needed from one table to another...

I'm Sending you the Algorithm So If anyone has any Idea on how it can be transported in VB for Access or any suggestions at all I would be gratefull.

i=1
B[1].LowBound=A[1].Time
j=1
while i<TotalofRecords do
if A.class<>A[i+1].class then
B[j].max=A[i+1].Time
B[j+1].min=A[i+1].Time
B[j].class=A.class
i=i+1
j=j+1
else
i=i+1
end if
Loop
B[j].max=A.Time 'To treat last value
B[j].class=A.class 'properly

Thanks In Advance
Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top