Access VBA fails when EXPORTing to AZURE SQL

Asked 2 years ago, Updated 2 years ago, 127 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=******.database.windows.net, 1433;" & _
    "User Id=*****@******; Password=****;" & _
    "Initial Catalog= {DBName};"
db.Execute "DROP TABLE Table Name"
db.Close
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 http://www.happy2-island.com/access/gogo03/capter00415.shtml


2022-09-30 11:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.