Access VBA fails when EXPORTing to AZURE SQL

Asked 5 months ago, Updated 5 months ago, 22 views

When the Access VBA attempts to EXPORT to AZURE SQL using the following instructions, an error occurs if the table exists on the server: DoCmd.TransferDatabase acExport, "ODBC Database", "ODBC; DSN=test; UID=test; PWD=test;", acTable, "TMP_test", "T_test", False, True

If you know how to delete or overwrite the server-side table, please let me know.

I look forward to your kind cooperation.

azure ms-access vba sql-azure

2022-09-30 11:35

1 Answers

I deleted it using the following method, and after exporting it to the server, I was able to import the link.

Setdb=New ADODB.Connection
db.Open "Provider=SQLOLEDB;"&_
    "Data Source=******, 1433;" & _
    "User Id=*****@******; Password=****;" & _
    "Initial Catalog= {DBName};"
db.Execute "DROP TABLE Table Name"
Set db = Nothing

'--- Upload temporary table to server
DoCmd.TransferDatabase acExport, "ODBC Database", _
    "ODBC; DSN = {DBName}; UID = ******; PWD = ****;", _
    acTable, LoalTableName, ServeTableName, False, True

'--- Import link to local
DoCmd.TransferDatabase acLink, "ODBC Database", _
    "ODBC; DSN = {DBName}; UID = ******; PWD = ****;", _
    acTable, LocalTableName, ServerTableName, False, True

reference site

2022-09-30 11:35

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.