Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Formatting and Subforms don't like each other

Status
Not open for further replies.

DBAchick

Programmer
Apr 27, 2000
61
I set up conditional formatting on form A and form B and it work exactly as I want it to. But when I imbed the forms as Subforms into form C, the conditional formatting does not work. The conditional formatting is an expression:

Expression is [Forms]![frmAsset]![CADetail]="Y"
Result Bold Text

Any help is appreciated.

 
A subform is not a member of the Forms collection. If you change the way you reference the subform to another technique, such as:
Code:
Me!CADetail = "Y"
then your formatting should work again.
 

Thank you for the response, but unfortunately it doesn't work. As a matter of fact, changing the reference to me!CADetail causes the conditional formatting to fail on the original form. Per Access Help, The expression must reference forms, the form name and the field name.

BTW, I forgot to mention that I am using Access 2000.

Any other ideas out there?
 
You must use the full path to the controls. This includes the mainform and subform.

Forms!MainFormName!SubformName!ControlName = "Y"
 
I'm assuming that CADetail is a control on the subform. Where is this reference to CADetail located? Are you referencing this control from the main form or from within the subform itself? If you are referencing CADetail from a main form, then Jerry is correct. You must fully qualify the control name. You can also use a shorter version like:
Code:
Me!subformname!controlname
I interpreted your original question to mean that form A or form B was referencing one of its own controls (CADetail), in which case the Me! format should work. Perhaps you could provide a bit more detail about your forms and controls.
 
Thank you, Jerry! Referencing both the main and sub form worked like a charm!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top