Conditional formatting based on previous record

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

Hey....I have a report in Access2002 in tabular format. I
need to set conditional formatting for the address text
box, so that it makes the address bold if the previous
record is identical.
For example:

Address

123 Maple Lane
123 Maple Lane

I would need both of these addresses to be bold on the
report....how do I do this with conditional formatting?

Thanks!
 
Hmm. Messy. The events of the section in the report will not be reliable
where the entries span pages, and would not be able to get the first one
bold either.

Base the report on a query. In the query, use subqueries to lookup the
previous and next address. Type the following into two fresh columns of the
query design grid (Field row). They assume a table named "tblAddress", with
fields named "Address" and "ID" (the primary key):

NextAddress: (SELECT TOP 1 Address
FROM tblAddress AS Dupe
WHERE Dupe.ID > tblAddress.ID ORDER BY Dupe.ID )

PriorAddress: (SELECT TOP 1 Address
FROM tblAddress AS Dupe
WHERE Dupe.ID < tblAddress.ID ORDER BY Dupe.ID DESC )

Now, to achieve the bold formatting in the report:
1. Now open the report in design view.

2. Select the Address text box.

3. Choose Conditional Formatting from the Format menu.

4. Set Condition 1 to:
Expression Is

5. Enter the expression:
([Address] = [PriorAddress]) OR ([Address] = [NextAddress])

6. Click the "B" buttron for bold.
 
Back
Top