Change text box color based on a value

  • Thread starter Thread starter Jasmine
  • Start date Start date
J

Jasmine

How do I change the color of a textbox (which is a date)
in the ff. scenario:

1. Continuous form.
2. Recordsource = two join linked tables.
3. if the date is 60 days less than current date.

Thanks for any help!
 
if you're using Access 2000 or later, open the form in design view and click
on the textbox to select it. then click on Format, Conditional Formatting.
leave the Field Value Is selection alone. change the "between" selection to
"less than" and type in
DateAdd("d",-59,Date())
then change the backcolor using the button in the dialog box, and click OK.

hth
 
I'm sorry I did not specify it but I'm using Access 97 and
I don't have that conditional formatting.
Any more ideas?Thanks.
 
none, sorry. suggest you wait about a day to see if somebody else posts back
with a solution, and if not then you can repost, starting a new thread - and
specifying A97 - and hope for an answer.

good luck.
 
I'm sorry I did not specify it but I'm using Access 97 and
I don't have that conditional formatting.
Any more ideas?Thanks.

I don't believe it's possible with Access 97, however, see Steven
Lebans site:
http://www.lebans.com
Possibly he has a database example which will work using Access 97.
 
Jasmine

I had this problem and was give the suggestion that you use the on
current event you test the value and change the forecolor to what you wish.

Private Sub Form_Current()
Dim ClrBlue as Long
Dim ClrBlack as Long
ClrBlue = 16711680
ClrBlack = 0
If Me![YourDateTextBox]<Date()-59 Then
Me![YourDateTextBox].Forecolor = ClrBlue
else
Me![YourDateTextBox].Forecolor = ClrBlack
End If

Hope This Helps

Randy
Happy to try to help those who have helped me.
 
Randy is correct, that will change the color. but in Continuous form view,
whatever color is applied to the Current record will also show on *all*
records.
recommend you follow Fred's suggestion:
-----------
I don't believe it's possible with Access 97, however, see Steven
Lebans site:
http://www.lebans.com
Possibly he has a database example which will work using Access 97.
-----------


Randy Fritz said:
Jasmine

I had this problem and was give the suggestion that you use the on
current event you test the value and change the forecolor to what you wish.

Private Sub Form_Current()
Dim ClrBlue as Long
Dim ClrBlack as Long
ClrBlue = 16711680
ClrBlack = 0
If Me![YourDateTextBox]<Date()-59 Then
Me![YourDateTextBox].Forecolor = ClrBlue
else
Me![YourDateTextBox].Forecolor = ClrBlack
End If

Hope This Helps

Randy
Happy to try to help those who have helped me.


Jasmine said:
I'm sorry I did not specify it but I'm using Access 97 and
I don't have that conditional formatting.
Any more ideas?Thanks.
 
Back
Top