G
GLT
Hi,
I have the following code which checks for nulls and if the field(s) are
null, then it will turn the boarder of the box (which all the fields are
listed in) and the field label red.
When the field has been updated with a value, then the colours will change
from red back to green.
This works fine, except it will not change the last "red" field back to green.
For example, when I test it, if there are three fields that turn red, then
after I update the three fields one by one, they all turn green except the
last field.
If anyone could advise what is wrong with this logic I would be most greatful:
Dim errTag As Variant
errTag = 0
If IsNull(Me![cmb_BoxStat]) Or IsNull(Me![cmb_RecBy]) Or IsNull(Me![Quantum
No]) Or (IsNull(Me![cmb_RecBy])) Or IsNull(Me![Recall Date]) Or
IsNull(Me![cmb_Urg]) Then
If IsNull(Me![cmb_BoxStat]) Then
Me![lbl_BoxStat].ForeColor = 255
Me![Box23].SpecialEffect = 0
Me![Box23].BorderColor = 255
errTag = 1
Else
Me![lbl_BoxStat].ForeColor = 8421376
Me![Box23].SpecialEffect = 3
Me![Box23].BorderColor = 0
End If
If IsNull(Me![cmb_RecBy]) Then
Me![lbl_RecBy].ForeColor = 255
Me![Box23].SpecialEffect = 0
Me![Box23].BorderColor = 255
errTag = 2
Else
Me![lbl_RecBy].ForeColor = 8421376
Me![Box23].SpecialEffect = 3
Me![Box23].BorderColor = 0
End If
If IsNull(Me![Quantum No]) Then
Me![lbl_QtnNo].ForeColor = 255
Me![Box23].SpecialEffect = 0
errTag = 3
Else
Me![lbl_QtnNo].ForeColor = 8421376
Me![Box23].SpecialEffect = 3
Me![Box23].BorderColor = 0
End If
If IsNull(Me![cmb_RecBy]) Then
Me![lbl_RecBy].ForeColor = 255
Me![Box23].SpecialEffect = 0
errTag = 4
Else
Me![lbl_RecBy].ForeColor = 8421376
Me![Box23].SpecialEffect = 3
Me![Box23].BorderColor = 0
End If
If IsNull(Me![Recall Date]) Then
Me![lbl_RecDte].ForeColor = 255
Me![Box23].SpecialEffect = 0
errTag = 5
Else
Me![lbl_RecDte].ForeColor = 8421376
Me![Box23].SpecialEffect = 3
Me![Box23].BorderColor = 0
End If
If IsNull(Me![cmb_Urg]) Then
Me![lbl_Urg].ForeColor = 255
Me![Box23].SpecialEffect = 0
errTag = 6
Else
Me![lbl_Urg].ForeColor = 8421376
Me![Box23].SpecialEffect = 3
Me![Box23].BorderColor = 0
End If
End If
If (Me![cmb_BoxStat] = "WAITING - ON ORDER") And (errTag = 0) Then
MsgBox "WOULD YOU LIKE TO SEND AN EMAIL?", vbOKCancel, "EMAIL NOTIFICATION"
SendMessage True
End If
End Sub
I have the following code which checks for nulls and if the field(s) are
null, then it will turn the boarder of the box (which all the fields are
listed in) and the field label red.
When the field has been updated with a value, then the colours will change
from red back to green.
This works fine, except it will not change the last "red" field back to green.
For example, when I test it, if there are three fields that turn red, then
after I update the three fields one by one, they all turn green except the
last field.
If anyone could advise what is wrong with this logic I would be most greatful:
Dim errTag As Variant
errTag = 0
If IsNull(Me![cmb_BoxStat]) Or IsNull(Me![cmb_RecBy]) Or IsNull(Me![Quantum
No]) Or (IsNull(Me![cmb_RecBy])) Or IsNull(Me![Recall Date]) Or
IsNull(Me![cmb_Urg]) Then
If IsNull(Me![cmb_BoxStat]) Then
Me![lbl_BoxStat].ForeColor = 255
Me![Box23].SpecialEffect = 0
Me![Box23].BorderColor = 255
errTag = 1
Else
Me![lbl_BoxStat].ForeColor = 8421376
Me![Box23].SpecialEffect = 3
Me![Box23].BorderColor = 0
End If
If IsNull(Me![cmb_RecBy]) Then
Me![lbl_RecBy].ForeColor = 255
Me![Box23].SpecialEffect = 0
Me![Box23].BorderColor = 255
errTag = 2
Else
Me![lbl_RecBy].ForeColor = 8421376
Me![Box23].SpecialEffect = 3
Me![Box23].BorderColor = 0
End If
If IsNull(Me![Quantum No]) Then
Me![lbl_QtnNo].ForeColor = 255
Me![Box23].SpecialEffect = 0
errTag = 3
Else
Me![lbl_QtnNo].ForeColor = 8421376
Me![Box23].SpecialEffect = 3
Me![Box23].BorderColor = 0
End If
If IsNull(Me![cmb_RecBy]) Then
Me![lbl_RecBy].ForeColor = 255
Me![Box23].SpecialEffect = 0
errTag = 4
Else
Me![lbl_RecBy].ForeColor = 8421376
Me![Box23].SpecialEffect = 3
Me![Box23].BorderColor = 0
End If
If IsNull(Me![Recall Date]) Then
Me![lbl_RecDte].ForeColor = 255
Me![Box23].SpecialEffect = 0
errTag = 5
Else
Me![lbl_RecDte].ForeColor = 8421376
Me![Box23].SpecialEffect = 3
Me![Box23].BorderColor = 0
End If
If IsNull(Me![cmb_Urg]) Then
Me![lbl_Urg].ForeColor = 255
Me![Box23].SpecialEffect = 0
errTag = 6
Else
Me![lbl_Urg].ForeColor = 8421376
Me![Box23].SpecialEffect = 3
Me![Box23].BorderColor = 0
End If
End If
If (Me![cmb_BoxStat] = "WAITING - ON ORDER") And (errTag = 0) Then
MsgBox "WOULD YOU LIKE TO SEND AN EMAIL?", vbOKCancel, "EMAIL NOTIFICATION"
SendMessage True
End If
End Sub