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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a Form from VBA 2

Status
Not open for further replies.

crobg

MIS
Jun 12, 2004
140
US
I am trying to create a form through VBA. I have got the create form metod to work but when I try to edit any of the form's properities I get an error stating that the form is not available.
Code:
Sub TestNewForm()

Dim fm As Form

Set fm = CreateForm(, "Template")

fm.Properties("Recordset") = "Customers" 'Stops here with a Run Time Error 2455, Object no longer available.
fm.Properties("Name") = "frmCustomers" 'Stops here with a Run-time error 2135, Property is read only.

End Sub

When I click help nothing comes up.
 
And this ?
fm.RecordSource = "Customers"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sorry about that it's been a long day. That fixed that line. I still can't change the name.

Thanks.
 

For some reason, the name is a read-only property. I used
this as a workaround:

DoCmd.Close acForm, "Form1", acSaveYes
DoCmd.Rename "NewName", acForm, "Form1"


TomCologne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top