• copy from 2 table in different database…

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » copy from 2 table in different database…

    Author
    Topic
    #463577

    Sub CopyTable()

    Dim sDBFromPath As String, sDBToPath As String
    Dim dbTo As DAO.Database
    Dim sSQL As String, MIO_DB As String

    MIO_DB = “tracciato_19-25ottobre2009_finale”

    sDBFromPath = “C:APPLICAZIONItracciato_19-25ottobre2009.mdb”
    sDBToPath = “C:APPLICAZIONIMonitoraggio integrato.mdb”

    Set dbTo = DBEngine.OpenDatabase(sDBToPath)

    sSQL = ” SELECT * INTO PREL_DA_ACCODARE FROM ” & MIO_DB & ” IN ‘” & sDBToPath & “‘”
    Debug.Print sSQL
    dbTo.Execute sSQL

    End Sub

    error in query!!!!!!!!
    Why?

    In effect i want to copy in “one shot only” all records from “C:APPLICAZIONItracciato_19-25ottobre2009.mdb”
    table “tracciato_19-25ottobre2009_finale” into “C:APPLICAZIONIMonitoraggio integrato.mdb” table PREL_DA_ACCODARE

    Note:
    The name of each fields in the two table are different but the number of fileds are the same.
    I’m sure the path of mdb and the name of table correct.

    peraph with ADo i can solve?
    other way are welcome

    Viewing 0 reply threads
    Author
    Replies
    • #1183920

      Shouldn’t it be

      sSQL = “SELECT * INTO PREL_DA_ACCODARE FROM ” & MIO_DB & ” IN ‘” & sDBFromPath & “‘”

      • #1183921

        Shouldn’t it be

        sSQL = “SELECT * INTO PREL_DA_ACCODARE FROM ” & MIO_DB & ” IN ‘” & sDBFromPath & “‘”

        HUMMMMMMMMMMMMMMM….
        have this error: tracciato_19 non trovato(not found) but the dubt is the error refeer a truncate name of table… peraph DAO not consider long name?
        In other case ADO can solve my prob?

        • #1183930

          Try

          sSQL = “SELECT * INTO PREL_DA_ACCODARE FROM [” & MIO_DB & “] IN ‘” & sDBFromPath & “‘”

    Viewing 0 reply threads
    Reply To: copy from 2 table in different database…

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: