Is there a way, when iterating through a forms controls collection, to determine if a control has a "Value" property?
I am writing a class module to handle default values for controls. In the form's OnOpen event the class is initialized and gets sent the form object. It uses WithEvents to hook up to the forms OnLoad and OnUnload events. When the form loads, the class iterates trhough each control and checks the tag property for the value "default='xxx'" where xxx is the default name. If this tag exists it adds the control to a collection. The class then sets each control in the collection to the default value in a Defaults table that keys off of the xxx portion, or creates a row if it does not exist. During Unload it captures the value from each control and sets it in the Defaults table.
I only want to add controls to the collection if there is a possiblilty of the control having a value. This will make the code more robust by not attempting to take or set a value of a control such as a line or rectangle that has the correct tag value but no value property.
Any help would be greatly appreciated
Thanks,
Tom
I am writing a class module to handle default values for controls. In the form's OnOpen event the class is initialized and gets sent the form object. It uses WithEvents to hook up to the forms OnLoad and OnUnload events. When the form loads, the class iterates trhough each control and checks the tag property for the value "default='xxx'" where xxx is the default name. If this tag exists it adds the control to a collection. The class then sets each control in the collection to the default value in a Defaults table that keys off of the xxx portion, or creates a row if it does not exist. During Unload it captures the value from each control and sets it in the Defaults table.
I only want to add controls to the collection if there is a possiblilty of the control having a value. This will make the code more robust by not attempting to take or set a value of a control such as a line or rectangle that has the correct tag value but no value property.
Any help would be greatly appreciated
Thanks,
Tom