You are checking for three conditions
Code:
If iEMB = -1 Then 'OUT OF BALANCE : BLACK
OutputString1 = OutputString1 & "<strong><font color=""black"">" & sClDiv & "</font></strong>" & ", "
ElseIf iEMB = -1 And sOOBFix Is Not Null Then 'BALANCED : RED
OutputString1 = OutputString1 & "<strong><font color=""Red"">" & sClDiv & "</font></strong>" & ", "
Else
'Unmatched situation code here
End If
Your code is only testing for two possibilities and they're not mutually exclusive, in other words nothing will ever meet your
Elseif iemb = -1 and soobfix is not null because everything with the iemb being -1 will be picked up in the first portion of your IF string
Instead you'd want something like:
Code:
If iEMB = -1 AND isnull(soobfix) Then 'OUT OF BALANCE BOLD BLACK
OutputString1 = OutputString1 & "<strong><font color=""black"">" & sClDiv & "</font></strong>" & ", "
ElseIf iEMB = -1 And Not Isnull(sOOBFix) Then 'BALANCED BOLD RED
OutputString1 = OutputString1 & "<strong><font color=""Red"">" & sClDiv & "</font></strong>" & ", "
Else 'OTHERWISE : Normal Text
outputstring1 = outputstring1 & scldiv & ","
End If
This is saying
if iEMB is True or -1 and sOOBFix is null make your text bold black
if iEMB is True or -1 and sOOBFix is NOT null make your text bold red
Otherwise, just use normal text.