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

Modify Field Names from a Form

Status
Not open for further replies.

johnkiwi

Instructor
Apr 13, 2001
2
NZ
I want to be able to add or alter field names on a form FROM the form. The form has been set up with the fields I require, but in case of later need, others are also in place, simply called "Other1", "Other2", etc.
I want the user to be able to add further fields, or MORE IMPORTANTLY, to be able to alter these "Other" fields with more appropriate names as the need arises.

Thanks.
Great site! So much useful stuff! Thanks again.
John Kiwi
 
John,

In addition to being somewhere between difficult to impossible, this sounds like a really bad idea.

IF you need to modify a from/report dynamically, it would be better to add entirely new controls and sset their properties. You cannot do this with an open form, however you can open a new instance of a form object in design mode and manipulate it programmatically (add/delete controls and edit control properties. When "done" open the new instance and close the current one. This approach is reasonably well documented in "CreateControl"
MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Look up the ControlSource property in the help file, and check the example. You can reassign text boxes, list and combo boxes, and some other controls at run time.

The changes won't be saved in the form design; to do that you'd have to make them in design view. But you may be able to keep the specs of the changes in a table, and use the form's Open event to customize the form each time it opens.

I'm kind of in agreement with MichaelRed, though. Having your users change the form design dynamically seems open to a lot of pitfalls. Say, for example, they connect a text box to a field that already has another text box, and type different values in the two text boxes. Which one gets stored in the table? At least, I'd be careful about how much freedom they have in making these field assignments. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top