Solved

conditional formatting by expression; works different for subform?

Posted on 2004-08-19
4
408 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

623 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