I'm currently using the following code to reference the label that is linked to a textbox.
frm is a parameter passed to the sub and contains the name of the calling form. ctl is declared as a control and is populated by looping through the controls in the form. Anyway, back to my question. If there isn't a label linked to the textbox, I get an error saying object doesn't exist (as would be expected, since it really doesn't exist). Is there a way to test if the object does exist so that I can do something else with the textbox instead of its label?
Code:
Forms(frm).Controls(ctl.Name).Controls.Item(0).ForeColor = vbBlack
Comment