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!

Changing color for a specific record

Status
Not open for further replies.

Eltoque

Technical User
Jan 12, 2002
21
US
I already know how to get text to change based on a value in a field but when I do it, it is doing it to the entire form. For example: When a certain number of days have passed, the formula I have will change the field to Green but when I click on that record it makes that field in all records change color. I want to be able to see all records (in a form by the way) change the proper color based on time passed for that specific record. In other words, each with their respective colors and not the whole from being the same color. I believe it has something to do with the title "Form_Current" but I cannot get it to specify a single record.
Here is what I am using right now:

Private Sub Form_Current()


' If value in LR text box is >6, display
' value in LR in red.
If (DateDiff(&quot;d&quot;, Me!LR.Value, Now()) < 7) Then
Me!LR.ForeColor = 32768 'Green
ElseIf (DateDiff(&quot;d&quot;, Me!LR.Value, Now()) > 6) Then
Me!LR.ForeColor = 32768 '255 'Red
ElseIf (DateDiff(&quot;d&quot;, Me!LR.Value, Now()) = 7) Then
Me!LR.ForeColor = 16711680 'Blue
End If


End Sub

I have searche all over these forums and found nothing specific to this. Any help would be greatly appreciated. Thank you.
 
Sorry, I mis-typed. The 6s in my formula are 7s but I do not think that makes a difference in the question I am asking.
 
In Access 2000 there is condiditional formatting. Click on the field(s) you want to change color on and under Format on the menubar select conditional formatting. It is self explanatory.
 
My apologies. I am currently working on Access '97. Like I said, I can get it to work on the form but I have all the forms visible (like a data sheet) and was looking to get it to change color only for the records marked.
ACCESS 97 may be too limited.
 
In a continuous form, which is what it sounds like you are using, A97 does not support different-row-formattting without some fancy code. However I've seen stuff floating around which purports to do this, probably using an add-in of some sort. Check out TBroadbent's FAQ of Access resources on the Web and look for Dev Ashish' Access Web and other sites. I'm pretty sure you'll find something. Whether it will work for you or not is another subject...

78.5% of all statistics are made up on the spot.
Another free Access forum:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top