View Full Version : Condensing if statements


edojan
08-01-2007, 10:17 AM
Hi

Here is the code i have need to condense it and combine it into one statement. Reason being by the time it gets to
If Category.Value = "Department" the audit_que value already has -x-x-x ... in there ... how can i prevent audit_que from repeating -x-x-x over and over again? Maybe covert all to case? or better if/then?

If Category.Value = "500K Audit" And IsNull(AUDIT_QUEUE) Then
Debug.Print AUDIT_QUEUE.Value
Else: AUDIT_QUEUE.Value = AUDIT_QUEUE.Value & "-x"
End If

If Category.Value = "FYI Error" And IsNull(AUDIT_QUEUE) Then
Debug.Print AUDIT_QUEUE.Value
Else: AUDIT_QUEUE.Value = AUDIT_QUEUE.Value & "-x"
End If

If Category.Value = "Department" And IsNull(AUDIT_QUEUE) Then
Debug.Print AUDIT_QUEUE.Value
Else: AUDIT_QUEUE.Value = AUDIT_QUEUE.Value & "-x"
End If

Thanks!

Rabbie
08-01-2007, 10:35 AM
Does this do what you want


If (Category.Value = "500K Audit" or Category.Value = "FYI Error" or Category.Value = "Department") _
And IsNull(AUDIT_QUEUE) Then
Debug.Print AUDIT_QUEUE.Value
Else
AUDIT_QUEUE.Value = AUDIT_QUEUE.Value & "-x"
End If



By the way why are doing a debug.print of AUDIT_QUEUE when you know it is NULL

edojan
08-01-2007, 10:42 AM
debug is just statement since i don't want anything to be done if its null ...