Results 1 to 3 of 3

Thread: Transfer databases in VB6

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Littlehampton, W Sussex GB
    Posts
    203

    Post

    I have seen documented a TransferDatabase Method within Access - is there anything I can use in VB6 to transfer tables from a database located in one place to another database? (other than via DOS commands?)

    I need to be able to export and import sections of an access database using VB6.

  2. #2
    New Member
    Join Date
    Jul 1999
    Posts
    7

    Post

    To transfer data from one table into another table in a different .mdb. Try the following:

    Private Sub cmdTransfer_Click()

    Dim dbOne As Database
    Dim dbTwo As Database
    Dim SQL As String

    On Error GoTo ErrHnd
    'Just in case it screws up

    Set dbOne = Workspaces(0).OpenDatabase("c:\Wherever\Wherever\Main.mdb")
    'Obviously, this is the first db
    'just set pathway
    Set dbTwo = Workspaces(0).OpenDatabase("c:\Wherever\Wherever\Other.mdb")
    'duh, and the second database

    SQL = "INSERT INTO Table1,Table2,Table3 IN 'c:\Wherever\Wherever\Other.mdb'SELECT Table1,Table2,Table3. *FROM Table1,Table2,Table3"

    dbOne.Execute SQL, dbFailOnError

    dbOne.Close

    Set dbOne = Nothing

    Exit Sub

    ErrHnd:

    MsgBox Err.Description

    'Just define where the two db's are
    'and what you want in them
    'just be sure to include the ' '
    'marks in the SQL part
    'Simple as butter...........

    End Sub


    Hope This Helps,

    --Steph

    ------------------


    [This message has been edited by Off2Cabo (edited 10-08-1999).]

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Littlehampton, W Sussex GB
    Posts
    203

    Post

    Thanks - that looks great - just what i'm after

Posting Permissions

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



Click Here to Expand Forum to Full Width