I'm trying to write a module (Access 2000) to import tables from Excel. The imported tables need to overwrite the existing tables, so I want to check if the table already exists and if it does delete the table prior to importing the update.
I've tried this, but keyword "Exists" isn't valid in Access
Private Sub Update()
Dim BookingsTable As String
Dim FilePath As String
BookingsTable = "tblMens Bookings"
FilePath = "C:\Documents and Settings\kphillip\My Documents\Dollar General\Mens 1o1.xls"
If BookingsTable Exists Then
DoCmd.DeleteObject acTable, "tblMens Bookings"
End If
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, BookingsTable, FilePath, -1, "Bookings"
End Sub
KP
I've tried this, but keyword "Exists" isn't valid in Access
Private Sub Update()
Dim BookingsTable As String
Dim FilePath As String
BookingsTable = "tblMens Bookings"
FilePath = "C:\Documents and Settings\kphillip\My Documents\Dollar General\Mens 1o1.xls"
If BookingsTable Exists Then
DoCmd.DeleteObject acTable, "tblMens Bookings"
End If
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, BookingsTable, FilePath, -1, "Bookings"
End Sub
KP