Renaming an existing table using text from form textbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to rename a table using a title from a form textbox. I have tried using a macro like the following:

openform
runcommand:copy(name from textbox)
selectobject:table to be renamed
runcommand:rename
runcommand:rename(had to do this twice?)
runcommand:paste

I then get the following error:
The command or action 'paste' isn't available now.

Once I close the error dialog box I can type 'ctrl+V' and it paste the new title in from the clipboard. I can also rightclick in the highlighted title and select paste from the menu and it works.
Any suggestions or alternative methods would be greatly appreciated.
 
Just use DAO in VBA code:

CurrentDb().TableDefs("OldName").Name = "NewName"

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


Ukincallmejon said:
I need to rename a table using a title from a form textbox. I have tried
using a macro like the following:
openform
runcommand:copy(name from textbox)
selectobject:table to be renamed
runcommand:rename
runcommand:rename(had to do this twice?)
runcommand:paste

I then get the following error:
The command or action 'paste' isn't available now.

Once I close the error dialog box I can type 'ctrl+V' and it paste the new
title in from the clipboard. I can also rightclick in the highlighted title
and select paste from the menu and it works.
 
Back
Top