Results 1 to 4 of 4

Thread: help with VB code in MS access module

  1. #1
    Join Date
    Jun 2005
    Posts
    3

    help with VB code in MS access module

    Hi,

    I have a table called 'test1'. It has 3 columns 'ID', 'Tag', and 'Hierarchy'.

    I need to import the columns 'Tag' and 'Hierarchy' from 'test1' to 'test2' which has no data in it. I have attached the zip file with tables 'test1' and 'test2'(created a dummy table just to show how I would like the table to look like). Does anybody know how to write VB code for this. I appreciate any help from anyone.

    Thanks in advance
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2003
    Posts
    1,048
    Why are you using VB code to do this? That's like using a sledgehammer on a thumbtack.

    Just create a linked table from one database to the other and run a simple insert query.

  3. #3
    Join Date
    Jun 2005
    Posts
    3
    Hi Rawhide,

    Thanks for your reply. I need to use VB code as we have completed most of our work this way. I appreciate if anybody could help me with this.

    Thanks

  4. #4
    Join Date
    Feb 2003
    Posts
    1,048
    Here's two options:

    1. Create a connection to your first database
    2. Query for the data you want
    3. Load it into an array
    4. Close the connection to your first database
    5. Create a connection to your second database
    6. Loop through the array inserting each record from the array into your second database
    7. Close the connection to your second database


    1. Create a connection to your first database
    2. Create a connection to your second database
    3. Query for the data you want from your first database
    4. Loop through the recordset inserting each record from the recordset into your second database
    5. Close the connection to both databases

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •