By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,097 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,097 IT Pros & Developers. It's quick & easy.

ForeColor & BackColor Using Date Field

P: 1
Hi,

I have set up a report In Access 2003 where there are 2 check boxes I refer to to change the color of the Date of that record. That part is working.

I also need to Change the color of the date feild when the date in the field is 3 days or more older. I am currently using the following code.

Any Suggestions?
Thanks In Advance,
Ray

Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  2. Dim lngBlack As Long
  3. Dim lngRed As Long, lngGreen As Long, lngWhite As Long, lngYellow As Long
  4.     lngRed = RGB(255, 0, 0)
  5.     lngBlack = RGB(0, 0, 0)
  6.     lngGreen = RGB(60, 116, 44)
  7.     lngWhite = RGB(255, 255, 255)
  8.     lngYellow = RGB(255, 255, 0)
  9.  
  10.  If Check65 = -1 Then
  11.      Me!Date.ForeColor = lngWhite
  12.      Me!Date.BackColor = lngGreen
  13.      Else
  14.      Me!Date.ForeColor = lngBlack
  15.      Me!Date.BackColor = lngWhite
  16.  
  17.  If Check49 = -1 Then
  18.      Me!Date.ForeColor = lngBlack
  19.      Me!Date.BackColor = lngYellow
  20.         Else
  21.      Me!Date.ForeColor = lngBlack
  22.      Me!Date.BackColor = lngWhite
  23.  
  24. If Me.[Date Evaluated].Value = Now() + 3 Then
  25.      Me!Date.ForeColor = lngBlack
  26.      Me!Date.BackColor = lngRed
  27.         Else
  28.      Me!Date.ForeColor = lngBlack
  29.      Me!Date.BackColor = lngWhite
  30.  
  31.     End If
  32.     End If
  33.     End If
  34.  End Sub 
Mar 22 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.