PDA

View Full Version : Solved: Change textbox forecolor if date is earlier then today



ioncila
08-24-2012, 11:22 AM
Hi
I have the code below in a textbox and I want that date value be red if it's earlier than today. But I'm not getting that.

Private Sub txtValDss_Enter()
g_bForm = True
frmCalendar.Show_Cal
Me.txtValDss.Value = g_sDate
If g_sDate < Now Then
Me.txtValDss.ForeColor = RGB(255, 0, 0)
End If
With ActiveControl.Object
txtValDss.Value = Format(txtValDss.Value, "dd mmm yyyy")
End With
End Sub

I'm using the event 'Enter' to popup the calendar form

May you provide me some help please?
Thak you in advance.
Ioncila

ioncila
08-25-2012, 12:53 AM
Hi
I Have found the solution here in forum
http://www.vbaexpress.com/forum/archive/index.php/t-12160.html
and placed the code in another location in my project:
Once the form has a listview, I solved my issue putting the code to format textbox in the listview click event.
Cheers
Ioncila