Conditional formatting using expression - 2007

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Conditional formatting using expression - 2007

Post by Egg 'n' Bacon »

How do you use expressions in this?

I'd like to highlight certain records (on a continuous form) where there are 2 (or more) records. The one with the highest value in a defined field would be the one to highlight.

Is this possible?

NB I'd like to keep the form based on a table, as I expect to use it for data entry too.

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Conditional formatting using expression - 2007

Post by HansV »

In the Conditional Formatting dialog, select 'Field Value Is' in the first dropdown under Condition1.
Select 'equal to' in the second dropdown.
Enter the expression Max([FieldName]) in the box next to it, with the relevant field name substituted.
Apply the desired formatting, then click OK.
x48.png
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Re: Conditional formatting using expression - 2007

Post by Egg 'n' Bacon »

Not quite what I was thinking of (though the syntax does help). I probably did not explain very well.

If there were 2 records (like below), the record with the greater version number is the one I wish to be highlighted, but other records will not be changed.
Slide1.JPG
The example you gave Hans, will highlight an individual field that matches the Max of all the records.

I hope that makes more sense
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Conditional formatting using expression - 2007

Post by HansV »

Select 'Expression Is' from the first dropdown, then enter an expression like this in the box next to it (the second dropdown disappears when you select 'Expression Is' from the first one):

[Version]=DMax("Version","TblCourse","CourseName='" & [CourseName] & "'")

Substitute the correct table name and field names.
Best wishes,
Hans

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Re: Conditional formatting using expression - 2007

Post by Egg 'n' Bacon »

Lovely! That's what I wanted to do.

Mega thanks :)

JohnH
3StarLounger
Posts: 287
Joined: 09 Mar 2010, 23:16
Location: Canberra Australia

Re: Conditional formatting using expression - 2007

Post by JohnH »

Running a separate DMAX for each record is likely to be very slow. Whether you notice anything will depend on how many records there are, but it is something you watch out for.
Regards

John

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Re: Conditional formatting using expression - 2007

Post by Egg 'n' Bacon »

Cheers John.

I did notice a slight delay, when scrolling. But I don't envisage more than 100 records for that particular table (fingers crossed)