I just moved an application from A2000 to A2007 and I am having trouble with the DAO.tabledefs collection. Code that works fine in A2000 is failing in A2007.
I am using transferspreadsheet to create a new table from an xl file. Before I do, I check if the table already exists (using the same tableexists code that I have been using successfully for years) and delete it first with this code:
which is giving me an error item is not in the collection. When I check, the table name does exist.
If I comment out the above code transferspreadsheet creates a 2nd table with the same name & "1".
I am also counting the fields in this new table after it is imported using:
This also gives me the same not in collection error even though the table does exist. Both of these work just fine in A2000. Why are they causing errors in A2007?
Thanks,
Sup
I am using transferspreadsheet to create a new table from an xl file. Before I do, I check if the table already exists (using the same tableexists code that I have been using successfully for years) and delete it first with this code:
Code:
If TableExists(strTbl) Then
CurrentDb.TableDefs.Delete strTbl
End If
which is giving me an error item is not in the collection. When I check, the table name does exist.
If I comment out the above code transferspreadsheet creates a 2nd table with the same name & "1".
I am also counting the fields in this new table after it is imported using:
Code:
CurrentDB.TableDefs(strTbl).Fields.Count
This also gives me the same not in collection error even though the table does exist. Both of these work just fine in A2000. Why are they causing errors in A2007?
Thanks,
Sup