Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I refer to a control on another form

Status
Not open for further replies.

jrice174

Civil/Environmental
Nov 8, 2004
129
I am trying to perform the same function on combo boxes on different forms. I have 2 string variables called ControlName & FormName (i.e. FormName = "frmSchedule", ControlName = "tboDate"). I can use the frmSchedule.tboDate.value and it works fine but I'm trying to assign the form and control names to variables so I can use FormName.ControlName.value. Is there a way to do that?
 
Replies continue below

Recommended for you

You need to learn how to use Object Variables instead of just String Variables. I think you are looking for something like...

Dim objFormControl As Control
Dim objDateControl As Control

Set objFormControl = frmSchedule

Set objDateControl = objFormControl.tboDate

Debug.Print objDateControl.Value
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor