HELP.. :( [ Get row index and compare field value ]

hi guys,
Does anyone here can help me on how I could get this result on my report or could tell me if it is possible to get this kind of result.
This is the record of the EMPLOYEE 1 in the table.
And below is the required output I need in the report.
The user wants to see only the records from May 1 - 31, 2011.


VESSEL

POSITION

START DATE

END DATE









VESSEL 1

Cook

May 1 2011

May 3 2011

VESSEL 1

Cook

May 4 2011

May 6 2011

VESSEL 1

Cook

May 8 2011

May 10 2011

VESSEL 1

HELPER

May 11 2011

May 15 2011

VESSEL 2

Cook

May 16 2011

May 31 2011

VESSEL 2

Cook

June 1 2011

June 15 2011

Im thinking if I could call the row index or id and compare a certain value of its field on the next row,
Example: To merge the all the record in vessel 1 and cook position, the start date of the next row should be plus one on the enddate of the previous row. If not, then it would not merge and should be printed on the report… is it possible guys?

I hope I had explained it clear.
I NEED THIS RESULT IN MY REPORT: (below)


VESSEL

POSITION

START DATE

END DATE









VESSEL 1

Cook

May 1 2011

May 6 2011

VESSEL 1

Cook

May 8 2011

May 10 2011

VESSEL 1

HELPER

May 11 2011

May 15 2011

VESSEL 2

Cook

May 16 2011

May 31 2011

In this result the first and second row has been merge since it has same vessel and position, while the 3 row lapsed 1 day from row 2 so it shouldn’t merge to the first 2 rows, then on the fourth row, it has same vessel but different in position and the fifth row is different in vessel, while the sixth row is not cover in the range of time needed by the user.
Thanks in advance.

Miss Blue