B
bamrak
I have a form that displays records for a table. I have added some if
then statements to the form, but it appears that my date logic does
not work. In testing, it appears it is picking up the first record in
the form and using it for the logic. If I remove the date calculation,
the logic works across the whole form. Is there some other way I can
accomplish date logic to where it works on a row by row basis? ( in
the below code if I use Dt = Date, it returns the same failure).
The logic I am trying for should be If the difference between the
date in txtAssigned and today is more than 15 days = true.
Private Sub Frmt_Dt()
Dim Dt As Date
Dim lngRed As Long, lngYellow As Long, lngWhite As Long, lngBlack As
Long
Dim Dt As Date
lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)
Dt = Now
If DateDiff("d", Dt, Me.txtAssigned) > 15 Then
Me.txtAssigned.BackColor = lngYellow
Me.txtAssigned.ForeColor = lngBlue
End If
End Sub
Thank you for any help anyone can provide
then statements to the form, but it appears that my date logic does
not work. In testing, it appears it is picking up the first record in
the form and using it for the logic. If I remove the date calculation,
the logic works across the whole form. Is there some other way I can
accomplish date logic to where it works on a row by row basis? ( in
the below code if I use Dt = Date, it returns the same failure).
The logic I am trying for should be If the difference between the
date in txtAssigned and today is more than 15 days = true.
Private Sub Frmt_Dt()
Dim Dt As Date
Dim lngRed As Long, lngYellow As Long, lngWhite As Long, lngBlack As
Long
Dim Dt As Date
lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)
Dt = Now
If DateDiff("d", Dt, Me.txtAssigned) > 15 Then
Me.txtAssigned.BackColor = lngYellow
Me.txtAssigned.ForeColor = lngBlue
End If
End Sub
Thank you for any help anyone can provide