Conditional Formating

Jon123

Registered User.
Local time
Today, 15:59
Joined
Aug 29, 2003
Messages
668
Trying to setup a conditional format for a field on a form based on conditions from another field.

I have a form with [Field1] and [Field2]

I have a 3rd field called [New SMF]

What I want to do is have conditions on [New Field] so that if the value is greater than Field1 or less than Field2 the background of new field turns red.

How can I do this?

Jon
 
If you have Access 2000 or later, you can use Conditional Formatting on the Format menu.
 
Have your report open in design view
select the field that you want to conditionaly format
On the menu bar select format
then conditional formatting
 
I'm trying to use conditional format but I can seem to get the exp. right any ideas?

Jon
 
First of all, make sure your text boxes which contain the data are named differently than the data itself. If you created the form with a wizard, bound text boxes tend to have the same name as the data they house (which, incidentally, is VERY VERY VERY annoying, Microsoft!!). Therefore if you have a data field actually called "Field1", then the text box should NOT be named "Field1". So in design mode, rename the text boxes somthing different that the data field names. It is recommended practice to use prefixes on controls in any case, so using your examples, rename the text box that is bound to Field1 to "txtField1" and Field2 to "txtField2". Finally, name the text box that you want to house the field "New SMF" as "txtSMF". Spaces in controls or fieldnames, while allowed, really make things complicated at times.

Once you have your changes, in design mode select txtSMF. On the Format menu, click "Conditional Formatting..." selection. Since you are going to create an expression, under Condition 1, change "Field Value Is" to "Expression Is". Now, since you want the formatting to occur if the value of SMF is more than the value of Field1 and less than the value of Field2, type the following in the text box to the right of "Expression Is:"

txtSMF.Value > txtField1.Value AND txtSMF.Value < txtField2.Value

Now set up the format conditions you need if that expression is True.

For more imformation on Conditional Formatting, check out this Tutorial.
 

Users who are viewing this thread

Back
Top Bottom