Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Easiest Way to Export/Import

Posted on 2003-11-04
6
Medium Priority
?
170 Views
Last Modified: 2010-05-03
Hi PPL

I have a question, I am export some data from 11 different tables, but its only the Primary Keys that I am actually exporting.

Its a little hard to explain but I am just going to give an example

Table1
Column 1 Value ---> 72
Column 2 Value ---> 59
Column 3 Value --> 'John'

Table2
Column 1 Value --->59
Column 2 Value --->77

Now because these numbers are generated by the system, they will probably exist in the target DB. So when I import, if I change Table1.Column2 Value to 85, I want an easy way to change Table2.Column1 Value to 85 also but I am working on a much larger scale.

I was thinking of using a Search and Replace function but then there are certain Columns that might have the same value and I might not want to change it. I was also thinking of using a collection, holding the old Value and the New Value, then check in the collection if a new value exists before I insert my record and then do the replace....

I am pretty sure that there is a better way to do this, I am just looking at a easy way to read and write... All my data once loaded is stored in an array of array, basically an array for each row in a table...

Any advice would be appreciated


0
Comment
Question by:Deshin13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 4

Expert Comment

by:PBuck
ID: 9679240
Do you have any control on how the data in Table1 gets added?  My first thought is to use Table1 as a 'Master' control table.  So when a new field gets added, a reference to Table2's location can be added also.

If you had Table1 designed something like;

FieldValue   table2ID
------------   -----------
72               190023
59               822212
John            

Where table2ID is a reference to Table1's autonumber or random (primary key).
Table2:

AutoNumber  FieldValue
--------------  ------------
190023         72
822212         59

If you have control over this situation, this is my first thought on how to ease this routine.  Good luck!
0
 
LVL 1

Author Comment

by:Deshin13
ID: 9684527
I was thinking about doing it something like that but holding it all in memory. Use a collection to hold the links between the old values and the new values....

I am going to try that out and see how it goes...
0
 
LVL 4

Accepted Solution

by:
PBuck earned 1000 total points
ID: 9687401
Yeah that sounds like a plan.  Depending on the size of your project you may want to use an array of type versus a collection (faster than a collection).

Private Type DB_FIELDS
    FieldValue as String     'Updated/New value
    Table2ID as Long       'Record number from Table2
    Etc ...
End Type
Private XX() as DB_FIELDS

With XX(0)
   .FieldValue = "79"         'If you want to keep the last value handy
   .Table2ID = 1
End With

With XX(1)
   .FieldValue = "59"         'If you want to keep the last value handy
   .Table2ID = 2
End With
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question