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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top