Question : Reformating an excel apreadsheet using vba

Greetings experts,

I am engaged in a quality assurance process in which local companies provide us with data from their databases so we can conduct a study.  They do this by exporting the information to an Excel spread sheet and from there we would like to be able to sort and perform stats on the data.

However, here is my delima.  The files we receive are formated as such.

Dispatch# | Impression | Date Rec | Date Disp | Date Arrived | Crew# | ... | Procedure
125           | Cardiac      | 7/2/2010  | 7/2/2010  | 7/2/2010       | P123    | ... | IV
125           | Cardiac      | 7/2/2010  | 7/2/2010  | 7/2/2010       | P123    | ... | Monitor
125           | Cardiac      | 7/2/2010  | 7/2/2010  | 7/2/2010       | P123    | ... | Blood Glucose
125           | Cardiac      | 7/2/2010  | 7/2/2010  | 7/2/2010       | P123    | ... | Medication
126           | ILI               | 7/3/2010  | 7/3/2010  | 7/3/2010       | P128    | ... | Blood Pressure
126           | ILI               | 7/3/2010  | 7/3/2010  | 7/3/2010       | P128    | ... | Oxygen
127           | Stroke        | 7/3/2010  | 7/3/2010  | 7/3/2010       | P126    | ... | Blood Pressure
127           | Stroke        | 7/3/2010  | 7/3/2010  | 7/3/2010       | P126    | ... | GCS
127           | Stroke        | 7/3/2010  | 7/3/2010  | 7/3/2010       | P126    | ... | Blood Glucose

This is the result of the one-to-many relationship in the database.  Each call can have many procedures.
What I need it to look like for the statistician is

Dispatch# | Impression | Date Rec | Date Disp | Date Arrived | Crew# | ... | Procedure | NewRow| |
125           | Cardiac      | 7/2/2010  | 7/2/2010  | 7/2/2010       | P123    | ... | IV               | Monitor    | Blood Glucose | and so on.

I need it to reformate the call information into one row and add each procedure to the end of the row.  

I am using Access 2007 and the number of rows before the "Procedures" row never changes.

Is this even possible?

Thanks,

Task

Answer : Reformating an excel apreadsheet using vba

What data type is [Dispatch ID]?  If it is text, try:

SELECT   [Dispatch ID],  [Impression],  [Destination Basis],  [Date Received],  [Date Enroute],  [Date Arrived],  [Date Leave Ref],  [Date Arrive Rec],  [Crew 2],  [First Name],  [Last Name],  [Date of Birth],  [Address Line 1],  [City],  [State],  [Zip Code],  [Gender],  [Age In Years],  [Trauma Code],  [EMD Card Number],  [Scene Grid],  [Receiving Other],  [Response Code],  [Mode to Ref],  [Mileage Loaded],  [Mode to Rec],  [Receiving Hospital],  [GCS First],  [GCS Last],  [Blood PressureD First], [Blood PressureS First], [Blood PressureD Last], [Blood PressureS Last], [Heart Rate First], [Heart Rate Last], [Respiration First], [Respiration Last], [Procedure Time], DConcat("[Procedure]","[Care Test Data]","[Dispatch ID] = '" & [Dispatch ID] & "'", ";")  AS Procedues
FROM [Care Test Data]
GROUP BY [Dispatch ID],  [Impression],  [Destination Basis],  [Date Received],  [Date Enroute],  [Date Arrived],  [Date Leave Ref],  [Date Arrive Rec],  [Crew 2],  [First Name],  [Last Name],  [Date of Birth],  [Address Line 1],  [City],  [State],  [Zip Code],  [Gender],  [Age In Years],  [Trauma Code],  [EMD Card Number],  [Scene Grid],  [Receiving Other],  [Response Code],  [Mode to Ref],  [Mileage Loaded],  [Mode to Rec],  [Receiving Hospital],  [GCS First],  [GCS Last],  [Blood PressureD First], [Blood PressureS First], [Blood PressureD Last], [Blood PressureS Last], [Heart Rate First], [Heart Rate Last], [Respiration First], [Respiration Last], [Procedure Time];
Random Solutions  
 
programming4us programming4us