Hi all, I have the following code which appends 3 excel ranges to 3 different Access tables, and works perfectly in a normal Access linked table. However, when I try it on an Access Table linked to DB2, I get a runtime error 3270 "Property not found" when trying to append the data to the AGY table. Both of the other two tables works fine.
PS: I set the Access_DB and Excel_Path variables elsewhere. Also, the reason why I set oApp to visible, is so that I can enter the username and password when connecting to DB2, and this is also working correctly.
Does anyone know why this is not working for me?
PS: I set the Access_DB and Excel_Path variables elsewhere. Also, the reason why I set oApp to visible, is so that I can enter the username and password when connecting to DB2, and this is also working correctly.
Does anyone know why this is not working for me?
Code:
Sub ACCESS_APPEND()
Set oApp = CreateObject("Access.Application")
oApp.Visible = True
oApp.OpenCurrentDatabase Access_DB
DoCmd.RunSQL "DELETE CRC.* FROM CRC"
DoCmd.RunSQL "DELETE MTM.* FROM MTM"
DoCmd.RunSQL "DELETE AGY.* FROM AGY"
'Does not work on this line - this table holds roughly 40000 records (with 4 fields)
oApp.DoCmd.TransferSpreadsheet acImport, 8, "AGY", Excel_Path, True, "AGY_Range"
'Works on this line - this table holds roughly 500 records (with 3 fields)
oApp.DoCmd.TransferSpreadsheet acImport, 8, "MTM", Excel_Path, True, "MTM_Range"
'Works on this line - this one holds roughly 80 records (with 5 fields)
oApp.DoCmd.TransferSpreadsheet acImport, 8, "CRC", Excel_Path, True, "CRC_Range"
oApp.Quit
Set db = Nothing
End Sub