Created table does not show up in Table Object list but is created

My code to create a table with VBA in an ACCESS 2010 database works, but it does not appear in the window.  How can I get it to appear in the tables listing right after it is created?  I know it is there because if I run the code again, it errors out with the statement object already exists.
Sandra SmithRetiredAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
Use:
    RefreshDatabaseWindow
...after your code creates the table
see here as well, for more info:
https://msdn.microsoft.com/en-us/library/office/Aa221557%28v=office.11%29.aspx

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
My code to create a table
\
...can you post this code please?


Depending on what method you use, (SQL, ADO, DAO, CopyObject, ...etc), the database window may refresh automatically....
Sandra SmithRetiredAuthor Commented:
Below is the code and it does create all the tables.  
Private Sub CreateTempTables()
        'Create hldIntegerValueModel tables.
        CurrentDb.Execute "CREATE TABLE hldIntegerValue (RecNumber counter, IntegerValue INTEGER)"
        CurrentDb.Execute "CREATE TABLE hldIntegerValue1 (RecNumber counter, IntegerValue INTEGER)"
        CurrentDb.Execute "CREATE TABLE hldIntegerValue2 (RecNumber counter, IntegerValue INTEGER)"
        CurrentDb.Execute "CREATE TABLE hldIntegerValue3 (RecNumber counter, IntegerValue INTEGER)"
        CurrentDb.Execute "CREATE TABLE hldIntegerValue4 (RecNumber counter, IntegerValue INTEGER)"
        CurrentDb.Execute "CREATE TABLE hldIntegerValue5 (RecNumber counter, IntegerValue INTEGER)"
        CurrentDb.Execute "CREATE TABLE hldIntegerValue6 (RecNumber counter, IntegerValue INTEGER)"

End Sub
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Sandra SmithRetiredAuthor Commented:
I also want to shorten this to a loop rather than individual statements just for the heck of it.
Rey Obrero (Capricorn1)Commented:
like what jeff mentioned

CurrentDb.Execute "CREATE TABLE hldIntegerValueModelSS (RecNumber counter, IntegerValue INTEGER)"
Refreshdatabasewindow    'add this line
Sandra SmithRetiredAuthor Commented:
Thanks, works.
Rey Obrero (Capricorn1)Commented:
test this

Private Sub CreateTempTables()
        'Create hldIntegerValueModel tables.
        Dim strTable As String, j As Integer
        strTable = "hldIntegerValue"
        CurrentDb.Execute "CREATE TABLE [" & strTable & "] (RecNumber counter, IntegerValue INTEGER)"
        For j = 1 To 6
        CurrentDb.Execute "CREATE TABLE [" & strTable & j & "] (RecNumber counter, IntegerValue INTEGER)"
        Next
        RefreshDatabaseWindow
End Sub
Sandra SmithRetiredAuthor Commented:
Final code, FYI
Private Sub CreateTempTables()
Dim strTableName As String
Dim i As Integer

        strTableName = "hldIntegerValue"
    For i = 1 To 7 'Loops through seven times for all table names, not six times
        'Create hldIntegerValueModel tables.
        CurrentDb.Execute "CREATE TABLE " & strTableName & " (RecNumber counter, IntegerValue INTEGER)"
       strTableName = "hldIntegerValue" & i
    Next i
        RefreshDatabaseWindow

End Sub
Jeffrey CoachmanMIS LiasonCommented:
Actually, you should change the accepted post to what Rey posted.

Basically, all I posted was the command.

It looks like you took the syntax Rey post to actually build your working solution, so he should get the points...
Jeffrey CoachmanMIS LiasonCommented:
I put in a request t have the accepted solution changed from my post to Reys...
;-)

Jeff
Rey Obrero (Capricorn1)Commented:
nevermind Jeff, you provided the answer to the original question.
Jeffrey CoachmanMIS LiasonCommented:
either way,
No matter to me...

At the very least, I would like the points split...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.