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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code for changing a textbox background color in an Access Report

Status
Not open for further replies.

Silkydog

Technical User
Joined
Dec 4, 2003
Messages
3
Location
US
I have an Access 2000 Database to track employee training. One of the fields lists the expiration date of a given course. I want to highlight the dates that are within 30 days of expiration with a yellow background (or text color) and past due dates with a red background (or text color) in my reports. Anybody got some code examples to share?
 
In the OnFormat Event of the Details Section of the Report

Code:
Const cLightGrey = 12632256
Const cWhite = 16777215

    If Me.Detail.BackColor = cWhite Then
        Me.Detail.BackColor = cLightGrey
      Else
        Me.Detail.BackColor = cWhite
    End If

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
Or take a look at conditional formatting on the format menu.

BTW - this is the forms forum, you might try the reports forum for questions relating to reports.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top