Conditional formatting based on previous record

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!
 
A

Allen Browne

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top