rename a form in an external database

Q

Question Boy

Is there a way to rename an object, a form, in an external database?

I tried

Dim db As DAO.Database
Set db = OpenDatabase("C:\BAD\BAD 1.0.mdb")
With db.Containers("Forms").Documents("frm_Invoicing_Items")
.Name = "newname"
End With
db.Close
Set dbA = Nothing

But it keeps spitting out an error about being read only when the help file
states it can be used to set the value?!

I know I can use the following statement in the current db, but do not know
how to adapt it to work on a remote db.
DoCmd.Rename "frm_Invoicing_Items1", acForm, "frm_Invoicing_Items"

Thank you for your help,

QB
 
S

Stuart McCall

Question Boy said:
Is there a way to rename an object, a form, in an external database?

I tried

Dim db As DAO.Database
Set db = OpenDatabase("C:\BAD\BAD 1.0.mdb")
With db.Containers("Forms").Documents("frm_Invoicing_Items")
.Name = "newname"
End With
db.Close
Set dbA = Nothing

But it keeps spitting out an error about being read only when the help
file
states it can be used to set the value?!

I know I can use the following statement in the current db, but do not
know
how to adapt it to work on a remote db.
DoCmd.Rename "frm_Invoicing_Items1", acForm, "frm_Invoicing_Items"

Thank you for your help,

QB

You can use DoCmd via automation by prefixing it with a variable set to the
db's Application object:

App.DoCmd.Rename ...

(untested idea)
 
Q

Question Boy

It connect an execute the code, but returns an error because the vbe is
password protected and it states that I must supply the password. How can I
get around that?

QB
 

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