Suggestions for Table Update

Hi All,

I have a table that features unique rows of data.  This table is basically a list of dependents listed under an employee.  To export this into a flat file, the dependents need to be changed from being listed below the employee to being listed across the employee's record in a subsequent table.  I've already created the subsequent table that provides enough space for 12 unique dependents.  I'm trying to figure out the best way of updating the table with all the dependents that fall within the criteria of an expression.  

For Example:

Table 1
ID #     Dependent ID#
1a         2a
1a         3a
1a         4a

Table 2

1a                 2a                  3a                     4a  

I've created an update query that updates the appropriate columns for the first dependent; however, I feel like this might be a very cumbersome process of doing it, i.e. with 12 separate update queries.  Does anyone have any suggestions?

Thank you.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
upload a db with the table.
Gustav BrockCIOCommented:
You can create a creative crosstab query:

    First(Table1.[Dependent ID#])
    Table1.[Dependent ID#];


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The crosstab is the simplest solution but you will first need to assign sequence numbers to the dependents for an employee so each dependent has a number from 1 to 12.  Then when you pivot, 1 will update column 1, 2 will update 2, etc.

Select EmpID, DependentID, SeqNum = DCount("*", "tblDependents", "EmpID = " & EmpID & " AND DependentID < " & DependentID) + 1 AS SeqNum;

This will number the dependents for an employee sequentially in order by their DependentID.  Do not save the SeqNumber.  Just use this as part of the query that is used for the crosstab.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.