Hi, I am having trouble generating a message when multiple conditions meet, the code I am using is below. The data is coming in from PI process book and are all declared correctly.
If CV3033Run = "On" And FD3031Run = "STOP" And FDFD3032RUN = "STOP" And PC1SV < 400 And PC2WRB = "Off" And PC2ERB = "Off" And PC2WRomLev > 20 And PC2WLev > 20 And PC2ERomLev > 20 And PC2ELev > 20 And PC2Display = False Then
RoomtoMove = PC1SVTPH - PC1MIN
PC2MAX = PC2WMAX + PC2EMAX
PC2Current = PC2WSV + PC2ESV
PC2Availability = PC2MAX - PC2Current
PC2Display = True
End If
If PC2Display = True And RoomtoMove < PC2Availability Then
PC1By = PC1SV - RoomtoMove
ab = "Reduce PC1 MAX SP To "
MsgBox [ab] & [PC1By], vbCritical, "Reduce PC2 MAX SP"
PC2Display = False
ElseIf PC2Display = True And RoomtoMove > PC2Availability Then
PC2MAX = PC2WMAX + PC2EMAX
PC2Current = PC2WSV + PC2ESV
PC2Availability = PC2MAX - PC2Current
PC2By = PC1SV - PC2Availability
ac = "Reduce PC1 MAX SP To "
MsgBox [ac] & [PC2By], vbCritical, "Reduce PC1 MAX SP"
PC2Display = False
End If
Any help is much appreciated.
If CV3033Run = "On" And FD3031Run = "STOP" And FDFD3032RUN = "STOP" And PC1SV < 400 And PC2WRB = "Off" And PC2ERB = "Off" And PC2WRomLev > 20 And PC2WLev > 20 And PC2ERomLev > 20 And PC2ELev > 20 And PC2Display = False Then
RoomtoMove = PC1SVTPH - PC1MIN
PC2MAX = PC2WMAX + PC2EMAX
PC2Current = PC2WSV + PC2ESV
PC2Availability = PC2MAX - PC2Current
PC2Display = True
End If
If PC2Display = True And RoomtoMove < PC2Availability Then
PC1By = PC1SV - RoomtoMove
ab = "Reduce PC1 MAX SP To "
MsgBox [ab] & [PC1By], vbCritical, "Reduce PC2 MAX SP"
PC2Display = False
ElseIf PC2Display = True And RoomtoMove > PC2Availability Then
PC2MAX = PC2WMAX + PC2EMAX
PC2Current = PC2WSV + PC2ESV
PC2Availability = PC2MAX - PC2Current
PC2By = PC1SV - PC2Availability
ac = "Reduce PC1 MAX SP To "
MsgBox [ac] & [PC2By], vbCritical, "Reduce PC1 MAX SP"
PC2Display = False
End If
Any help is much appreciated.