skennedy10
asked on
Refer to a subform's control's properties using a variable for the subform name.
I have about 11 subforms on tabbed pages on a single form. I am trying to set them all with the exact same properties to eliminate the jumping--and need this type of coding for other things, too.
I wish to have a module which will control the size properties and the location of several "special textboxes."
I have variables for the actual subform names, strPageAfrm, strPageBfrm, etc. assigned as public constants since I will be duplicating this database many times with slightly different names. I want to change things once instead of 12 or multiples of 12 times.
In the On Current event I have the code <strCurrentSubform = strPageAfrm>, etc. (without the <>)
I found posts where I can reference the subform by
forms(strCurrentSubform) <forms(variableformysubfor m)>
but I need to refer to the subform by also including the name of the parent form, I suppose. (Access tells me I have to do something different!)
Please write answers in general terms-- (like what I have above in < >). I think everyone understands that better than trying to use my actual terms.
Thanks!
Susan
I wish to have a module which will control the size properties and the location of several "special textboxes."
I have variables for the actual subform names, strPageAfrm, strPageBfrm, etc. assigned as public constants since I will be duplicating this database many times with slightly different names. I want to change things once instead of 12 or multiples of 12 times.
In the On Current event I have the code <strCurrentSubform = strPageAfrm>, etc. (without the <>)
I found posts where I can reference the subform by
forms(strCurrentSubform) <forms(variableformysubfor
but I need to refer to the subform by also including the name of the parent form, I suppose. (Access tells me I have to do something different!)
Please write answers in general terms-- (like what I have above in < >). I think everyone understands that better than trying to use my actual terms.
Thanks!
Susan
ASKER
Steve,
Thanks for a quick reply.
I don't really need to refer to the main form or the control by variable names (although I will right now since I have to show my product tomorrow morning!), so can I refer to some by the "collection" and other parts not?
Susan
Thanks for a quick reply.
I don't really need to refer to the main form or the control by variable names (although I will right now since I have to show my product tomorrow morning!), so can I refer to some by the "collection" and other parts not?
Susan
You can use Forms!ParentForm!SubForm.F orm to set the subForms’s properties.
Forms!ParentForm!SubForm!C ontrol to refer to a control on the subForm.
Forms!ParentForm!SubForm!C
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, Stephen. I'm just now getting into understanding collections and variables within them are definitely different!
Great and fast! (This is why ee is my homepage!)
Susan
Great and fast! (This is why ee is my homepage!)
Susan
Great! I agree ee is so useful
Steve
Steve
forms(strParentForm).form.
Steve