rename table in access database...

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

rename table in access database...

Post by sal21 »

I use for my project a blank table named SERVIZIO with 7 fields. (is a service table)
Is possible to recopy into the same database, via ADO or other drive+vba for excel, and rename the table SERVIZIO and maintain the old table SERVIZIO for future use?

User avatar
HansV
Administrator
Posts: 78493
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: rename table in access database...

Post by HansV »

You could execute a SQL string

SELECT * INTO NewTable FROM SERVIZIO

This will create a table NewTable and copy the records from SERVIZIO into it.
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

Re: rename table in access database...

Post by sal21 »

HansV wrote:You could execute a SQL string

SELECT * INTO NewTable FROM SERVIZIO

This will create a table NewTable and copy the records from SERVIZIO into it.
tKS Hans but the SERVIZIO not have any data...
I need only to recopy the table SERVZIO and rename in NewTable.

User avatar
HansV
Administrator
Posts: 78493
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: rename table in access database...

Post by HansV »

If SERVIZIO doesn't have any records, executing the SQL string will create an empty table NewTable with the same fields as SERVIZIO.
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

Re: rename table in access database...

Post by sal21 »

HansV wrote:If SERVIZIO doesn't have any records, executing the SQL string will create an empty table NewTable with the same fields as SERVIZIO.
ok tks.

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

Re: rename table in access database...

Post by sal21 »

HansV wrote:If SERVIZIO doesn't have any records, executing the SQL string will create an empty table NewTable with the same fields as SERVIZIO.
OK,
during the exceute of sql i have the database opened...
i dont see into the database the new table created... to see tath i nedd to close and reopen the database. 2 little question:

-Existis a refresh metod to see in real time the new table created? (similar the F5 in Access menu)

-I can use, in other case, the new table if i dont see?

User avatar
HansV
Administrator
Posts: 78493
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: rename table in access database...

Post by HansV »

If you have Access open, you only need to select View | Refresh or press F5 to see the new table. No need to close and reopen the database.
Even if you don't see it yet, it exists, so you can work with it in queries etc.
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

Re: rename table in access database...

Post by sal21 »

HansV wrote:If you have Access open, you only need to select View | Refresh or press F5 to see the new table. No need to close and reopen the database.
Even if you don't see it yet, it exists, so you can work with it in queries etc.
Good!