Hi. I use MS Access 2002 and I have a database with 2 forms, one in continuous view. I want to change background colors (or text colors) when a field “ActionTime” is closed to the actual time. I have studied a lot of threats here, but still I have problems to make it works.
To test the functionality, I have used the following code:
Private Sub Form_Current()
If Me.GateArea = "2" Then
Me.GateArea.BackColor = vbBlue
Me.Destination.BackColor = vbBlue
(More fields)
Else
Me.GateArea.BackColor = vbRed
Me.Destination.BackColor = vbRed
(More fields)
End If
End Sub
This works fine in normal form view, but not in continuous view.
I know to use the conditional format, but this will only work for one field. I want to change the color of all fields on the current record based on changes on ActionTime.
Second question is how to code the data change. ActionTime is based on clock. I have used the following code, but it seems it is wrong somewhere:
If(DateDiff("n", [ActionTime]< Now()+10) Then
Me.GateArea.BackColor = vbBlue
Me.Destination.BackColor = vbBlue
(More fields)
Else
Me.GateArea.BackColor = vbRed
Me.Destination.BackColor = vbRed
(More fields)
End If
End Sub
Thanks in advance for any help.
To test the functionality, I have used the following code:
Private Sub Form_Current()
If Me.GateArea = "2" Then
Me.GateArea.BackColor = vbBlue
Me.Destination.BackColor = vbBlue
(More fields)
Else
Me.GateArea.BackColor = vbRed
Me.Destination.BackColor = vbRed
(More fields)
End If
End Sub
This works fine in normal form view, but not in continuous view.
I know to use the conditional format, but this will only work for one field. I want to change the color of all fields on the current record based on changes on ActionTime.
Second question is how to code the data change. ActionTime is based on clock. I have used the following code, but it seems it is wrong somewhere:
If(DateDiff("n", [ActionTime]< Now()+10) Then
Me.GateArea.BackColor = vbBlue
Me.Destination.BackColor = vbBlue
(More fields)
Else
Me.GateArea.BackColor = vbRed
Me.Destination.BackColor = vbRed
(More fields)
End If
End Sub
Thanks in advance for any help.