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

Change the color of an unbound textbox based on a value.

Status
Not open for further replies.

topgun64

IS-IT--Management
Feb 5, 2008
6
US
Hello Everyone,

I have a form which has a combobox bound to a payee field and I also have a date field. On the form there is an unbound text box called JAN1. What I am trying to accomplish here is when the user selects a payee from the combox and enters a date the unbound textbox changes to green. I have added the below code as the control source for the unbound textbox but I am not sure if I am on the right track.

I dont think the Date procedure is correct below. Somehow I need it look at just the Month of January. So if the Payee is equal to HR Electric and the payment was made say 2 Jay 08 the unbound textbox changes it color to green.

=IIf(CalendarInfo!Payee="HR Electric" And CalendarInfo!Date="Jan",Me.JAN1.BackColor=[vbGreen])
 
Not sure where you have your line of code but to get the month you could use Format(CalendarInfo!Date,"MMM") = "Jan" Provided it is a date field.
 
Thank You Captain D. Just what I was looking for-worked perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top