Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Posts
    114

    Unanswered: Transferring Data in Access/VB6

    I am writing an app that processes fitness event results (running races, etc) and I have a 'raw' access database with a single table that collects data from my timer. I want to transfer that data periodically to another access database, or another table within the same access database, to make changes and still preserve the data in the original table. I need to do this in vb6 code. I am ok writing and reading the data. I just need some advice on the best way to get data from the original to the 'edit' table/db to make my changes.

    Any suggestions?

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    Add Microsoft ActiveX Data Objects Library to your project (ADO) and then write the following code:

    Code:
    Dim cn As ADODB.Connection
    
    Set cn = New ADODB.Connection
    
    cn.Provider = "Microsoft.Jet.OLEDB.4.0"
    cn.Properties("Data Source").Value = App.Path & "\test.mdb"
    
    cn.Open
    
    cn.Execute "INSERT Table2 (Field1, Field2) SELECT Field1, Field2 FROM Table1"
    
    cn.Close
    
    Set cn = Nothing
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

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