WestBillWest
asked on
I cannot see newly created table in VB code though it exists. Trouble with TableDefs...
Newly created table can not be seen until I get out of Access then back in.
Table I have deleted manually is still seen from my Code.
I have scripted an import of a "FileName.exe_MMDDYY.csv" table but would like to check if a table name exists that I create within the function. If the table exists I would like to increament the latest version suffix by 1 and check for that table until I have a unique table name. i.e. If TableName_1 exists create TableName_2.
I loop through the table names until I get an error on - Set tdf = db.TableDefs(tblName). This means the table does not exist and I can go on. Else, Increament the suffix by 1 and check again until the table is not found. The problem is that Access does not see the table I last created and the records are appended to that table. When debugging I can see the table in the Access Object List but the code does not recognize.
Table I have deleted manually is still seen from my Code.
I have scripted an import of a "FileName.exe_MMDDYY.csv" table but would like to check if a table name exists that I create within the function. If the table exists I would like to increament the latest version suffix by 1 and check for that table until I have a unique table name. i.e. If TableName_1 exists create TableName_2.
I loop through the table names until I get an error on - Set tdf = db.TableDefs(tblName). This means the table does not exist and I can go on. Else, Increament the suffix by 1 and check again until the table is not found. The problem is that Access does not see the table I last created and the records are appended to that table. When debugging I can see the table in the Access Object List but the code does not recognize.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
just take note that
refreshdatabasewindow
works for all objects in the database not just table..
refreshdatabasewindow
works for all objects in the database not just table..
capricorn1, great point.
ASKER
Thank you for the follow up. I think I will use this as a solution because of that point.
ASKER