Condensing if statements

edojan

Registered User.
Local time
Yesterday, 22:40
Joined
Dec 19, 2006
Messages
26
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!
 
Does this do what you want
Code:
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
 
debug is just statement since i don't want anything to be done if its null ...
 

Users who are viewing this thread

Back
Top Bottom