rename tables

J

Joseph Smith

every now and again I need to link tables to sql they come through with dbo_
and then the name I then have to manually rename the table, easier than
changing existing code.

Can anyone please tel me how I can maybe change the name of the table by
macro or code?

Many thanks.

JS.
 
Z

ZenoParadox

Tables are objects and can be renamed, deleted, what have you the sam
as anything else. Look up the Table object, the Tables container, an
TableDefs... in there lies your answer
 
N

Nikos Yannacopoulos

Joseph,

Try this line of code:

currentdb().tabledefs("OldTableName").name = "NewTableName"

HTH,
Nikos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top