Link to home
Start Free TrialLog in
Avatar of tg4fsi
tg4fsiFlag for United States of America

asked on

Code to Import a Multi Value Field in Microsoft Access

I am in need of some VBA code to import and convert data into an Access multi-value field.

Yes, I know I should not be using them but I have no choice.  I work in ecommerce and I get CSV exported data in the following format:

Products
--------
ProductCode, CategoryIDs

Example:
"Red Widget", "1,3,5"
"Blue Widget", "3"


Categories
----------
CategoryID, CategoryName

Example:
"1", "Furniture"
"3", "Tables"

I need to run data analysis on our store so I need to bring in the data and create the relationships.  I will also need to eventually export the data in the same format which is why I am staying with the multi-value field.  Since I cannot import into a multi-value field I figured this method would work:

1. Import the Products into a temporary table: _tblProducts
2. Using VBA code, append the data to a Products table and at the same time populating the multi-value field with the category IDs.

So I'm looking for the code that will cycle through _tmpProducts and append the data to the table Products while properly filling Products!CategoryIDs multi-value field.

Thanks,
Erik
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tg4fsi

ASKER

Yeah I've thought about that...I know it is the proper way of doing it.  I guess what slows me down on that is one store I deal with has 100,000 products and each product could be apart of 5-10 categories so that many to many table could be gigantic.  But Access simply does this in hidden tables anyways for multi-value fields, right?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial