Hi
I am having issues with dates in conditional formatting.
This line is not formatting all rows to red if the field [ETC] is less than today's date. But some rows are returned red, what tells me it is not passing as a date but string. (see attached)
c.FormatConditions.Add acExpression, acEqual, "[ETC] < '" & DATE & "'"
The lines remarked out do work as an example of checking a date is null.
Private Sub Form_Load()
Dim lngRed As Long
Dim lngWhite As Long
Dim lngBlack As Long
Dim lngYellow As Long
Dim lngGreen As Long
Dim lngBlue As Long
Dim lngBrown As Long
Dim lngPink As Long
Dim c As Control
Dim t As TextBox
lngRed = RGB(255, 0, 0)
lngWhite = RGB(255, 255, 255)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngGreen = RGB(0, 153, 76)
lngBlue = RGB(0, 0, 255)
lngBrown = RGB(153, 76, 0)
lngPink = RGB(255, 0, 255)
For Each c In Me.Controls
If (TypeOf c Is TextBox) Or (TypeOf c Is ComboBox) Then
c.FormatConditions.Delete
c.FormatConditions.Add acExpression, acEqual, "[ETC] < '" & DATE & "'"
'c.FormatConditions.Add acExpression, acEqual, "[DateSend] Is Null"
c.FormatConditions(0).Enabled = True
'c.FormatConditions(1).Enabled = True
c.FormatConditions(1).ForeColor = lngRed
'c.FormatConditions(0).ForeColor = lngbLUE
End If
Next
End Sub
Thanks
I am having issues with dates in conditional formatting.
This line is not formatting all rows to red if the field [ETC] is less than today's date. But some rows are returned red, what tells me it is not passing as a date but string. (see attached)
c.FormatConditions.Add acExpression, acEqual, "[ETC] < '" & DATE & "'"
The lines remarked out do work as an example of checking a date is null.
Private Sub Form_Load()
Dim lngRed As Long
Dim lngWhite As Long
Dim lngBlack As Long
Dim lngYellow As Long
Dim lngGreen As Long
Dim lngBlue As Long
Dim lngBrown As Long
Dim lngPink As Long
Dim c As Control
Dim t As TextBox
lngRed = RGB(255, 0, 0)
lngWhite = RGB(255, 255, 255)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngGreen = RGB(0, 153, 76)
lngBlue = RGB(0, 0, 255)
lngBrown = RGB(153, 76, 0)
lngPink = RGB(255, 0, 255)
For Each c In Me.Controls
If (TypeOf c Is TextBox) Or (TypeOf c Is ComboBox) Then
c.FormatConditions.Delete
c.FormatConditions.Add acExpression, acEqual, "[ETC] < '" & DATE & "'"
'c.FormatConditions.Add acExpression, acEqual, "[DateSend] Is Null"
c.FormatConditions(0).Enabled = True
'c.FormatConditions(1).Enabled = True
c.FormatConditions(1).ForeColor = lngRed
'c.FormatConditions(0).ForeColor = lngbLUE
End If
Next
End Sub
Thanks