Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create macro to rename table from list

Status
Not open for further replies.

realstandman

IS-IT--Management
Oct 29, 2003
87
US
How can I create a macro that will rename a table in a list?
 
Hi realstandman,

I presume you are using Access if you are talking about renaming a table - but what's the list? The command to rename is
Code:
[blue]DoCmd.Rename "[i]NewName[/i]", acTable, "[i]OldName[/i]"[/blue]

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Tony what i need to do is have a end user select a linked table and rename it to a table name that i have queries running off of. I would like to put some function in a form to do this.

stan
 
Hi Stan,

So, on your Form you have a Textbox or a Listbox or Combobox for entry of the linked Table Name - and a button with the Rename code above in its Click Event - except that instead of "OldName" you use [blue]YourTextBoxName[/blue] (or [blue]YourListBoxName[/blue]).

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
I keep getting an error message that Access can't find the field "|" referred to in your expression. Here is the code any ideas?

DoCmd.CopyObject [TEXN TOP TEN DATA], acTable, [Text24]
 
Hi Stan,

Leave out the brackets - put literals in quotes - and leave variables alone ...
Code:
[blue]DoCmd.CopyObject [red]"[/red]TEXN TOP TEN DATA[red]"[/red], acTable, Text24[/blue]

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top