Monday, April 27, 2015

VB6 copy table in between databases

//Make a connectionstring of source database (ftp.mdb)

Public Sub cnOPEN()

mdbname = "ftp.mdb"

    If cn.State = 1 Then
        cn.Close
    End If
    cn.Mode = adModeReadWrite
    cn.Open "Provider=MSDataShape.1;Data Provider = Microsoft.Jet.OLEDB.4.0;data source=" & App.Path & "\" & mdbname

End Sub

// copy table joborderauth from ftp.mdb to jobo in dlab.mdb

ap = App.Path & "\dlab.mdb"

cn.Execute "SELECT * INTO jobo IN '" & ap & "'FROM joborderauth"