Full Version: Referencing controls on a form with subforms
UtterAccess Forums > Microsoft® Access > Access Forms
PCtox
I have a main form called frmFieldInfo which has a tab control with addition subforms on it. The subform that I'm working with is called sfrmSilicaResults.
here's a control called Text36 on the main form that typically has a value of 480. I have an unbound text control on the subform called Text59. I'm trying to set up a macro that will enter the value of 8 into Text59 when Text36 is 480, a value of 9 when Text36 is 540 and a value of 10 when Text is 600.
I'm trying to do this using a conditional macro. I'm using the SetValue action, targeting the item [Forms]![sfrmSilicaResults]![Text59] and using the expression 8. I've attached the macro to the Lost Focus event on the Text36 control.
The problem is, the macro keeps telling me that it can't find the form sfrmSilicaResults. Is my description missing something?
Thanks
Peter
Doug Steele
Subforms aren't actually open, so they're not in the Forms collection.
o refer to them, you have to go through the parent form:
[Forms]![NameOfParentForm]![NameOfSubformControlOnParentForm].Form![NameOfContro
lOnSubform]
Note that depending on how you added the subform to the parent form, the name of the subform control on the parent form may be different than the name of the form being used as a subform.
For additional information, see Refer to Form and Subform properties and controls as "The Access Web"
travis
I am trying to set properties on subforms, but do it thru iteration so I can change all my subforms on my parent form. I just can't figure out what I need to do to iterate thru form names.
eaning, if I have a string variable (FormName) how do I get that to work with something like:
Me!FormName(this is a variable not the actual name).sourceobject = ""
FOr is that even the way to do it in VB?
Thanks
travis
PCtox
Thank you. That fixed the issue.
eter
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.