Good morning,
I hope someone can help me? this is my problem I have a piece of coding that I will add of the end that works out the datediff for a order date to current date which works fine, what I want to do is make the records change according to these rule, If < 3 then change green (New Order), If >3 and <7 then change Yellow(awaiting), If > 7 Then Change to red (Call becoming a Priority). I have done the coding under a Load for event but all the records turn the same color of the first record (Form is in a Continuous Form Format), If I do it under say a Click command and go so a different record and click it then the colour changes, I'm sure I'm missing something out so any help would be much appreciated
Here is the Code
I hope someone can help me? this is my problem I have a piece of coding that I will add of the end that works out the datediff for a order date to current date which works fine, what I want to do is make the records change according to these rule, If < 3 then change green (New Order), If >3 and <7 then change Yellow(awaiting), If > 7 Then Change to red (Call becoming a Priority). I have done the coding under a Load for event but all the records turn the same color of the first record (Form is in a Continuous Form Format), If I do it under say a Click command and go so a different record and click it then the colour changes, I'm sure I'm missing something out so any help would be much appreciated
Here is the Code
Code:
[COLOR=black][FONT=Verdana]Private Sub Form_Load()[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Dim lvalue As Integer[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]lvalue = DateDiff("d", [Order Date], Date)[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]If lvalue = 1 Then
Disctb.BackColor = vbGreen
ElseIf lvalue > 3 < 7 Then
Disctb.BackColor = vbYellow
Else
Disctb.BackColor = vbRed
End If
[/FONT][/COLOR]
end sub