Question : Report with two different records on same line

I have a table with Events of a warehouse.  Its records are Events of Items that are temporarily stored, their Ins and Outs of the warehouse.

Table1
ItemId   EventType   Date             Time     Client  ....
2345        IN           01/01/2004    15:00    John Doe
2345        OUT        06/01/2004    13:00    John Doe
....

I need a Report with the last OUT of an Item and its last IN too, for the report to calculate the difference between these dates.  This report will be exported to Excel so we can get a spreadsheet like:

ItemId   InDate           InTime   Client           OutDate         OutTime      Difference(days)
2345     01/01/2004     15:00    John Doe     06/01/2004      13:00                 5
....


What I haven't figured out is how can I get data from two different records on the same line of the report.

The report is based on a Query of the Table1. (maybe it can be done in the query?)

Thanks for your help in advance.

Mario

Answer : Report with two different records on same line

OK, I THINK I GOT IT NOW, please try it:

Basically, make a cross-tab query as follows:

Make a cross-tab query based on Table1
Press the Totals button on the toolbar
Add client field; Group By; Row Heading
Add ItemID; Group By; Column Heading
Add Date, rename field as "Date in: Date"; First; Row Heading
Add Date, rename field as "Date out: Date"; Last; Row Heading
Add Time; Max; Value

Sorry, I have to go work now lol.  Someone figure this out, but I think it's cloe to the solution!!!

Random Solutions  
 
programming4us programming4us