Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 25th, 2006, 03:59 PM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Manipulating data in access tables using VBA

I am converting an excel based information tool into an Access Database. Each row in the excel spreadsheet has a unique id, but there is a product column that contains multiple products in the same cell of the spreadsheet. Each product is separated with a space and an "&". I have imported the information into access "as-is" and am wanting to know if there is a way to loop through the information I imported into the access table (imported_data) and create a record in a separate table (Products)for each product listed in the product field of the imported data table. (i.e., if there are 3 products for one unique id, I would like to create 3 records in the product table for that unique id.) The record created will contain the unique id and each product the unique id has.
 
Old January 25th, 2006, 05:32 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There is, you'll have to create a VB function that will do it for you. I'm in a bit of a pinch right now so I can't do the code, but essentially you want to create a recordset from the table you imported, save the fields values into VB variables, use the VB string functions to parse the '&' delimited field, create a new record in a temporary table for each instance until it reaches the end of the field, then move to the next record. Loop through all the records doing that, then delete the original table and rename the temp table to whatever it is you want it to be known as.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Manipulating Data with Expressions baaul Reporting Services 2 June 22nd, 2006 10:14 AM
merge data in tables-access 2003 megank Access 2 April 5th, 2006 11:31 AM
Manipulating Data Problem - - - - Please Help! sendoh11 ASP.NET 1.0 and 1.1 Professional 1 June 29th, 2005 02:40 AM
Data in Word forms in Access Tables HowardB Access VBA 1 January 9th, 2004 09:18 AM
Manipulating data in ASP sri2004 Classic ASP Databases 0 June 17th, 2003 07:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.