Michael Paravicini
asked on
Indirect Outside reference of a form control?
I need to access a form control from a procedure. For example, I have the form "Client" and the control "Name" then I can fill the form control like this:
Call FillForm ("Client")
Sub FillForm (FormName As Variant)
Forms(FormName).name = "Test string"
end Sub
This works fine. However I now need to fill in many different controls of the same form and hence would like to concatenate the control as follows:
Call FillForm ("Client","Name")
Sub FillForm (FormName,FormCtrl As Variant)
Forms(FormName).FormCtrl = "Test string"
end Sub
Obviously this does not work. Is there a way how i can reference the control from a function (i cannot use me.controls...
Thank you MIchael
Call FillForm ("Client")
Sub FillForm (FormName As Variant)
Forms(FormName).name = "Test string"
end Sub
This works fine. However I now need to fill in many different controls of the same form and hence would like to concatenate the control as follows:
Call FillForm ("Client","Name")
Sub FillForm (FormName,FormCtrl As Variant)
Forms(FormName).FormCtrl = "Test string"
end Sub
Obviously this does not work. Is there a way how i can reference the control from a function (i cannot use me.controls...
Thank you MIchael
ASKER
Thank you but I'm calling it from an outside function. HOwever, I have found the solution for regular forms controls:
Forms(lFormName)("xF" & lFormNumber & "L" & ctr) = "Test string"
This works fine. I still have not found the solution for addressing in the same way BUTTONS.. Any help would very much be appreciated!
Forms(lFormName)("xF" & lFormNumber & "L" & ctr) = "Test string"
This works fine. I still have not found the solution for addressing in the same way BUTTONS.. Any help would very much be appreciated!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It depends on bit on the point of origin of your code calling.
Use this syntax:
Use this syntax:
Forms("formName").Controls("controlname")
Yahoo mail login
Open in new window
You could call it like so:FillForm Me