Results 1 to 4 of 4
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:\APPLICAZIONI\tracciato_19-25ottobre2009.mdb"
    sDBToPath = "C:\APPLICAZIONI\Monitoraggio 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:\APPLICAZIONI\tracciato_19-25ottobre2009.mdb"
    table "tracciato_19-25ottobre2009_finale" into "C:\APPLICAZIONI\Monitoraggio 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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Shouldn't it be

    sSQL = "SELECT * INTO PREL_DA_ACCODARE FROM " & MIO_DB & " IN '" & sDBFromPath & "'"


  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by HansV View Post
    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?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Try

    sSQL = "SELECT * INTO PREL_DA_ACCODARE FROM [" & MIO_DB & "] IN '" & sDBFromPath & "'"


Posting Permissions

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