you could do a weekly update qry
if x. then y then background color = blue/red whatever
or on your form have on the on current a bit of coding
if date field = > then ..........
I prefer the upqry option as its a qry done on request where as the on current runs every time the form is open
other users have preferences the on current does mean that it is "Live" ie 1 day pass the date critia then it works whereas the qry option only works after the update and would involve an extra fvield on your table
what you have is close
You need to code the 'Else' as well to tun it back to the right colour when newer than 6 months, try
Code:
Private Sub Form_Current()
If Me.[Actual Fitted Date] < DateAdd("m", -6, Date) Then
Me.FormHeader.BackColor = 15
Else
Me.FormHeader.BackColor = 123
End If
End Sub
what you have is close
You need to code the 'Else' as well to tun it back to the right colour when newer than 6 months, try
Code:
Private Sub Form_Current()
If Me.[Actual Fitted Date] < DateAdd("m", -6, Date) Then
Me.FormHeader.BackColor = 15
Else
Me.FormHeader.BackColor = 123
End If
End Sub
thanks for the reply and the help, but it doesn't seem to work, the formheader colour stays at else backcolour all the time, no matter what date i enter in "actual fitted date" field
It's a bit ilusive
You have used 'Date' as a field name in the table and on the form. Date is a reserved word in Access and it is getting confussed by your field. I did not have time to track it down on your form, but if you change
If Me.[Actual Fitted Date] < DateAdd("m", -6, Date) Then
To
If Me.[Actual Fitted Date] < DateAdd("m", -6, Now) Then