Creating a Loop and Output table in Access

eaddi

New Member
Joined
Apr 2, 2012
Messages
24
Hello,

I am new at creating Loops in Access. I want create a new column for each new occurrence of a ID using a loop. If there is a better way to accomplish this I am open to ideas.

Below is what I want to accomplish.

Table A

[TABLE="width: 500"]
<tbody>[TR]
[TD]ID[/TD]
[TD]Exception Id[/TD]
[TD]Exception Date[/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD]55576[/TD]
[TD]7/4/19[/TD]
[/TR]
[TR]
[TD]XYZ[/TD]
[TD]32797[/TD]
[TD]6/8/19[/TD]
[/TR]
[TR]
[TD]OPQ[/TD]
[TD]86290[/TD]
[TD]4/2/19[/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD]75479[/TD]
[TD]12/6/19[/TD]
[/TR]
[TR]
[TD]XYZ[/TD]
[TD]57580[/TD]
[TD]1/18/19[/TD]
[/TR]
[TR]
[TD]XYZ[/TD]
[TD]17083[/TD]
[TD]5/9/20[/TD]
[/TR]
</tbody>[/TABLE]


Output Table
[TABLE="width: 500"]
<tbody>[TR]
[TD]ID[/TD]
[TD]EXC1[/TD]
[TD]EXC2[/TD]
[TD]EX3[/TD]
[TD]EXC_DT1[/TD]
[TD]EXC_DT2[/TD]
[TD]EXC_DT3[/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD]55576[/TD]
[TD]75479[/TD]
[TD][/TD]
[TD]7/4/19[/TD]
[TD]12/6/19[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]OPQ[/TD]
[TD]86290[/TD]
[TD][/TD]
[TD][/TD]
[TD]4/2/19[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]XYZ[/TD]
[TD]32797[/TD]
[TD]57580[/TD]
[TD]17083[/TD]
[TD]6/8/19[/TD]
[TD]1/18/19[/TD]
[TD]5/9/20[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi,
What's wrong with the data in the format it already is in? Three columns sorted by Id, Exception, and Exception Date - looks great (maintainable, informative, scalable, and efficient)
 
Upvote 0
I have to compile the data by id to enter into another system. All data associated with each unique Id must be concatenated to be entered into a single field in another system. My ultimate entry will look like ID, Concatenate (Exc1,Exc2, Exc3), Concatenate (ExcDt1, Exc1Dt2, ExcDt3). I'm looking for a way to reduce the steps taken to create my ultimate format.
 
Upvote 0
What would happen if there were more than three exception dates, or more than three exception IDs?
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,215
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top