how to rename a form?

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

Guest

I've just built a function that creates a form and populates it with text
boxes, based on the view or query that is passed as an argument. The only
thing I can't seem to do is to make it save the form with a predetermined
name.

I thought I could save the form to a new name if it was in Design View, but
it seems the CurrentView property is Read-Only, so that didn't work.

Will I have to code the routine to copy the form and delete the original?

Thanks!
 
What is the purpose of creating a form programmatically? It is not really a
recommended practice and will lead to serious bloat. I am not even sure it
will work if you ever convert to mde.
If you can describe the objective, perhaps we can offer an alternative
suggestion.
 
Dave,

The form serves a query (a view, actually) that is built by code. The number
and names of fields in the query vary depending on the data source and the
user-selected options. Grouping and ordering is also user-specified.

The only other option I could see was to create a different form for each
possible query, which really would cause bloat. My plan is to overwrite the
form each time it is created: hence, no bloat.

I haven't looked into what would happen in an MDE environment; good point.

-- Allen
 
You will still get bloat. Overwriting the object will not prevent that.
There are a couple of other issues you will need to test for.
A form is limited to 754 controls and sections over its lifetime. That is,
when you add a control, the count increases by one, but deleting a control
does not decrement the count. I have not tested deleting a form and and
creating another form with the same name to see if that carries forward. I
would doubt it, but you should test for that because at 754, it doesn't take
long to blow that limit.

I would recommend a differnt approach.
Create the form and add as many controls as the maximum you will need for
your. Count the number of fields from the tables that could be included.
Make them all invisible.
At run time, make only those that you will be using visible.
This is a simplistic description, but it would be something to consider.
 
Hmmm... interesting. I think I'll leave things as they are, because I've got
it working, now. However, I'm going to file your response in case I get
bitten by the thing in future.

Cheers!
 
Back
Top