Link to home
Start Free TrialLog in
Avatar of WestBillWest
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.
ASKER CERTIFIED SOLUTION
Avatar of Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WestBillWest
WestBillWest

ASKER

I awarded Hi Tech more points because of the quick response, in the early AM.  The solution may have been small but my project would not have worked with out it.  Thank you very much.   Bill
just take note that
         refreshdatabasewindow
works for all objects in the database not just table..
Thank you for the follow up.  I think I will use this as a solution because of that point.