This is more of a note to self / posted to assist other that may have the same problem.
Setup:
I have a form named "Support_Master".
"Support_Master" has sub-form "subOrderSub" based on the form "Support_OrderSub".
"Support_OrderSub" has a sub-form "subItemDetails" based on the form named "Support_ItemDetails"
Support_ItemDetails displays each line item in an order with a color code indicating which warehouse will supply the item for the order.
When there were only four warehouses, we could use the three conditional formatting options for 2,3,4 while warehouse 1 had the default formatting. Now that a fifth warehouse has been added, a new color code was required which exceeded the limitations of the built in Conditional Format features.
The answer to this was to change the background color of the textboxes in the detail section of the form on the fly but I had to figure out how to reference them.
I learned that referring to the control name in context of its parent is what works.
Examples:
'This FAILS:
This Works:
Full working usage example:
Setup:
I have a form named "Support_Master".
"Support_Master" has sub-form "subOrderSub" based on the form "Support_OrderSub".
"Support_OrderSub" has a sub-form "subItemDetails" based on the form named "Support_ItemDetails"
Support_ItemDetails displays each line item in an order with a color code indicating which warehouse will supply the item for the order.
When there were only four warehouses, we could use the three conditional formatting options for 2,3,4 while warehouse 1 had the default formatting. Now that a fifth warehouse has been added, a new color code was required which exceeded the limitations of the built in Conditional Format features.
The answer to this was to change the background color of the textboxes in the detail section of the form on the fly but I had to figure out how to reference them.
I learned that referring to the control name in context of its parent is what works.
Examples:
'This FAILS:
Code:
Forms!SupportMaster!Support_OrderSub.Form!Support_ItemDetails
This Works:
Code:
Forms!Support_Master!subOrderSub.Form!subItemDetails
Full working usage example:
Code:
For Each Ctl In Forms!Support_Master!subOrderSub.Form!subItemDetails.Form
If Ctl.ControlType = acTextBox Or Ctl.ControlType = acComboBox Then
Ctl.BackColor = bgColor
End If
Next