Need Help with Code for Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I posted this in the wrong section. Could someone please tell me how to code
for the following? I have two date
fields. Date field 1 is red/bolded when Date field 1 is less than Date().
Date field 2 is Blank. However, When date field 2 is filled with an actual
Date, I want Date field 1 to turn grey and not bolded. I have tried
conditional formatting and have not been able to make it work. Any help will
be greatly appreciated as I am on a time sensitive project. Thank you.
 
Confused,
Using the AfterUpdate event of Date2... (use your own colors and object names)

If Not IsNull(Date2) Then
Date1.BackColor = QBColor(8)
Date1.FontBold = False
Else
Date1.BackColor = QBColor(12)
Date1.FontBold = True
End If

Place this same code in the OnCurrent event of the form.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
Thank you for responding. However, this is not working. These date fields
are in a subform. Do I put the same code in the ON CURRENT in the subform or
main form. Other than that, why would it not work? This is driving me nuts!
Can you please help?
 
These date fields are in a subform...
Use the Conditional Formatting on the Date1 field
Expession Is IsNull([Date2]) And [Date2]<Date()
and set up your bold or colors as required.
I tested... that should work...
Date1 will be Grey if less than Date, red if greater than Date, but in either case,
will turn Red if Date2 is entered.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
Just want to say, Thank you Thank you very much! At first it did not work,
so I went through with a find tooth and comb. It works! Thank you very much.

Al Campagna said:
Use the Conditional Formatting on the Date1 field
Expession Is IsNull([Date2]) And [Date2]<Date()
and set up your bold or colors as required.
I tested... that should work...
Date1 will be Grey if less than Date, red if greater than Date, but in either case,
will turn Red if Date2 is entered.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

TotallyConfused said:
Thank you for responding. However, this is not working. These date fields
are in a subform. Do I put the same code in the ON CURRENT in the subform or
main form. Other than that, why would it not work? This is driving me nuts!
Can you please help?
 
Back
Top