Full Version: Bolding New Information
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
Janene_P
In a report that I print out each time additional information is added to it, I would like for the new information to be bolded. Is this possible? Thanks for the help!
dannyseager
one way would be to add a number field to the table that the data comes from...

Then when the report is printed it also runs an update query to update the field for all the records in the table to 1.

That way you can identify which records are new.
MrDriftwood
An alternate method might be to change the BackColor of the detail section based on some formula. For example:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.txtInfo = 18 Then
Me.Detail.BackColor = 12632256 ‘grey
Else
Me.Detail.BackColor = 16777215 ‘white
End If
End Sub
dannyseager
Mr Driftwood,

I don't understand how that would work out if it's a new record or not.
MrDriftwood
You would have to have some way of determining if the record is new. It looks like you are looking for records added since the last run of the report? If so you would need to add a “date created” field to your table (and populate it with the date the record was created) and then when your report is run, grey only those records added after some “Baseline Date” – this could be the last run of the report or any other date. This baseline Date will be used to determine what records to color grey.

One way to do this if you are not running your report from a form, is to pass the “baseline date” (all records created after this date are considered new) in query results. For example you would build a parameter query similar to this (my example uses a table called tblNames):

PARAMETERS [Enter Baseline Date:] DateTime;
SELECT tblNames.CreateDate, [Enter Baseline Date:] AS BaselineDate
FROM tblNames;

When run, this query prompts you for a baseline date. Make this query the record source for your report. Then in the On Format section of the Detail section add this code to compare the Created Date against the Baseline date and change the BackColor of the section if the Created Date is greater than or equal to the Baseline date:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.CreateDate >= Me.BaselineDate Then
Me.Detail.BackColor = 12632256 'grey
Else
Me.Detail.BackColor = 16777215 'white
End If
End Sub

When you run your report, the user is prompted to enter a baseline date. Once entered, the report checks each detail line’s Create Date against the Baseline date. If the Create Date is greater than or equal to the Baseline, it turns the Backcolor grey. If the Create Date is less than the Baseline, it turns the BackColor white.
MrDriftwood
Danny: My original example was only to show how to grey a detail section. It didn’t deal with determining if a record is new.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.