G
Guest
I am using the following code for conditional formating in forms
Private Sub Comp1_AfterUpdate()
If Me!Comp1 > Me!Comp_Log_Isuue_Date Then
Me!Comp1.BackColor = 65280
ElseIf Me!Comp1 = Me!Comp_Log_Isuue_Date Then
Me!Comp1.BackColor = 12632256
Else: Me!Comp1.BackColor = 16777215
End If
End Sub
Private Sub Comp2_AfterUpdate()
If Me!Comp2 > Me!Comp_Log_Isuue_Date Then
Me!Comp2.BackColor = 65280
ElseIf Me!Comp2 = Me!Comp_Log_Isuue_Date Then
Me!Comp2.BackColor = 12632256
Else: Me!Comp2.BackColor = 16777215
End If
End Sub
The code works fine however I have 45 fields on each of four forms. Each of
the forms have the same field names (Comp1 Comp2 etc), how can I make a
common code that can be called from each of the forms bearing in mind I use
the code for Form_Current() and _AfterUpdate().
Private Sub Comp1_AfterUpdate()
If Me!Comp1 > Me!Comp_Log_Isuue_Date Then
Me!Comp1.BackColor = 65280
ElseIf Me!Comp1 = Me!Comp_Log_Isuue_Date Then
Me!Comp1.BackColor = 12632256
Else: Me!Comp1.BackColor = 16777215
End If
End Sub
Private Sub Comp2_AfterUpdate()
If Me!Comp2 > Me!Comp_Log_Isuue_Date Then
Me!Comp2.BackColor = 65280
ElseIf Me!Comp2 = Me!Comp_Log_Isuue_Date Then
Me!Comp2.BackColor = 12632256
Else: Me!Comp2.BackColor = 16777215
End If
End Sub
The code works fine however I have 45 fields on each of four forms. Each of
the forms have the same field names (Comp1 Comp2 etc), how can I make a
common code that can be called from each of the forms bearing in mind I use
the code for Form_Current() and _AfterUpdate().