Me("txtTextBox" & i).Value <--- this style?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

[short version] I need ... [Subform Control Name].Form![Control
Name].Property ... but I need to put it together on-the-fly

Any thoughts?



[Long version] I'm in a situation where I'm reading subform, control names,
and properties from a table, and I want to enable/disable them from code. I
don't know how to reference them. I've tried several styles like that of the
subject line, but I'm striking out.
 
You can reference objects like this by using the collection property of the
object and passing it's name. For example:
Me!MySubForm.Controls("NameOfControl").Properties("NameOfProperty")
 
David Mueller wrote in message
[short version] I need ... [Subform Control Name].Form![Control
Name].Property ... but I need to put it together on-the-fly

Any thoughts?



[Long version] I'm in a situation where I'm reading subform, control names,
and properties from a table, and I want to enable/disable them from code. I
don't know how to reference them. I've tried several styles like that of the
subject line, but I'm striking out.

I think you can play with similar as you're using in the subject of
this
thread, here are a couple of attempts

me.controls("SubformControl
Name").Form.controls("ControlName").Property

me("SubformControl Name").Form("ControlName").Property

strFormName = rs.fields("subformcontrolname").value
strControlName = rs.fields("controlname").value
me.controls(strFormName).Form.controls(strControlName).Property

me.controls(rs.fields("subformcontrolname").value).Form.controls(rs.fields("controlname").value).Property
 
Back
Top