Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BackColor Field Change in Access Report 1

Status
Not open for further replies.

EBox

Programmer
Dec 5, 2001
70
US
I have a report which lists a report of the year to date. There is a field entitled [Month] which is in date format mmm/yyyy, and I would like to be able to make a yellow BackColor of a report field named Highlight when the [Month] is the last one in the report (or, 30 days from today).

I'd like to set it up so that whenever I run the report, the most recent completed month has the Highlight box with a yellow BackColor, so that this data gets "highlighted".

Can anyone help with the programming in VB code here?

Thanks,
Eric
 
You need to use the OnFormat of the Detail of the report, and use code similar to this -

If DateAdd("m", 1, Me.b) >= Date Then
Me.b.BackStyle = 1
Me.b.BackColor = 65535
Else
Me.b.BackStyle = 0
End If

Where Me.b is the field on the report that you want to change the colour of. The DateAdd function in this example just adds a month to the date specified (Me.b).

Hope it helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top