0

I am trying to add a linked table to an Acccess database using ADO and ADOX (from excel).

However everytime I try, I receive the error: "Microsoft Access does not support linking to an Access database or Microsoft Office Excel workbook saved in a format that is a later version than the current database format."

Both the linked table and the target database are made using Access 2010 and are of the .accdb format. My code:

    Set cat = New ADOX.Catalog
    Set tbl = New ADOX.Table

    ' Open the catalog.
    cat.ActiveConnection = objConnection

    tbl.ParentCatalog = cat
    tbl.Name = "Promotions"
    tbl.Properties("Jet OLEDB:Link Datasource") = strCurrentPath & _
        "LocPrcCh.accdb"
    tbl.Properties("Jet OLEDB:Remote Table Name") = "Promotions"
    tbl.Properties("Jet OLEDB:Create Link") = True
    tbl.Properties("Jet OLEDB:Link Provider String") = _
        "MS Access;PWD=XXXXXXXXX;"

    cat.Tables.Append tbl

Returns the error after the last line. Any ideas how to make this work?

4

1 回答 1

0

Solved it.

My target file had the .accdb extension, but it was not in the 2007 format. When opened it said it was a 2002 - 2003 format access file.

The file was created in Access 2010, but the format was later changed I used a jetengine compacting function elsewhere in my program, which created a new version of the database in an older format.

于 2013-09-12T01:51:49.003 回答