A2003 on Win XP
Goal: Copy fresh data from production DB to my test DB. Code is in test DB.
Steps:
- Delete table "oldTable1".
- Rename "Table1" to "oldTable1"
- Import "Table1" from production DB to test DB.
When I try to delete "oldTable1" I get an error about "oldTable1" being in a relationship and it cannot be deleted. How do I delete the relationship so I can delete the table?
Here is my code:
Goal: Copy fresh data from production DB to my test DB. Code is in test DB.
Steps:
- Delete table "oldTable1".
- Rename "Table1" to "oldTable1"
- Import "Table1" from production DB to test DB.
When I try to delete "oldTable1" I get an error about "oldTable1" being in a relationship and it cannot be deleted. How do I delete the relationship so I can delete the table?
Here is my code:
Code:
' Delete old tables first.
DoCmd.DeleteObject acTable, "oldTable1"
' Rename tables to "old" prefix.
DoCmd.Rename "oldTable1", acTable, "Table1"
' Import real tables from M:
dbsrc = "M:\blah\production.mdb"
tname = "Table1"
DoCmd.TransferDatabase acImport, "Microsoft Access", dbsrc, acTable, tname, tname