Solved

conditional formatting by expression; works different for subform?

Posted on 2004-08-19
4
404 Views
Last Modified: 2006-11-17
I have a subform with continuous records that I'm attempting to do some basic conditional formatting on, by EXPRESSION.

The subform has two textboxes, Description and Quantity (there are others, but these are the only ones that matter).  The subform is bound to a view that populate both these values.

I am trying to do conditional formatting on the Description textbox based on the value in the Quantity textbox.
I open the subform in design view (note, not the parent form, just the subform).
In the conditional formatting window, with "Expression Is" selected, I put in the following:

[Forms]![frmOrdersCropList]![tbxQuantity]=0

Switch to Form View and it looks perfect, the 0 items are formatted differently from the non-zero items.
But then when I open the main form in Form View with this subform built in,  I get no conditional formatting (as if none of the Quantities are 0).

So, the next thing I tried was to do the conditional formatting from Design View of the main form, and set the expression to
[Forms]![frmOrders]![frmOrdersCropList]![tbxQuantity]=0

This time when I switch to Form View, ALL the lines are formatted conditionally (as if ALL the Quantities are zero).
So, is there some trick to getting the conditional formatting to work for subforms?

Thanks.

0
Comment
Question by:rsoble
  • 3
4 Comments
 
LVL 4

Accepted Solution

by:
naivad earned 500 total points
ID: 11847285
try this...


[Forms]![frmOrders]![frmOrdersCropList].Form![tbxQuantity]=0


For future reference...open a new query, in the criteria box, right click, click build. Expand Forms, Expand the parent form, expand the child form, double click on the child control and it will auto build this string for you
0
 
LVL 4

Expert Comment

by:naivad
ID: 11847320
oops...make sure the form in question is in design view at the time and expand 'loaded forms' first.


Hope this helps.
0
 
LVL 1

Author Comment

by:rsoble
ID: 11847717
Thanks for the quick answer.   It worked great.
Umm... all the rest was kinda gobbledygook to me, but I appreciate it nonetheless :)
0
 
LVL 4

Expert Comment

by:naivad
ID: 11848197
No problem. I just wanted to show you how I was able to come up with the answer so you could figure this out the easy way next time.


When you build queries in the query designer, you can add tables and fields. When you add a field you can can specify a "WHERE" condition by putting something in the criteria field.

If you right click in this field, there is a "BUILD" option. This brings up the "Expression Builder".  The expression builder will build that string for you buy just drilling down to the object you are looking for. SubForms and SubReports are difficult to build these expressions for as you have found out.  If the parent form (the one containing the subform) is open, then it will be displayed in the "FORMS" container under the "Loaded Forms" container If a form containing a subform is in the LOADED FORMS container, then any subforms will be displayed under that form. Once the desired subform/subreport is selected, you can then click on any of the controls on that subform/report. If you double click on the control, it will build the entire expression for you and place it in the text area at the top of the "expression builder". I find this to be an invaluable tool.

This works with any DB object you are trying to find.

If my directions are too confusing...then open access help and type expression builder.

Good Luck!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now