mlwallin said:
I just wanted to make sure I wasn't overlooking a way to avoid
repeating the source you're checking. I was hoping for something
like the TransSQL IN().
e.g. WHERE state IN ('CA', 'IN', 'MD')
If you really want to, and if none of the values contains any of the
other values, you can use InStr(), like this:
If InStr(Me!txtActivityCode, "/EMAIL/INCAL/TMADJ/") > 0 _
Or Not IsNull(Me.txtComments.Value) _
Then
' ...
End If
You have to pick a delimiter that will not appear in the values to be
tested. I doubt that will be as fast as just testing the individual
values.
You can also use a Select Case structure, but since you've got an
additional test that doesn't involve Me!txtActivityCode, the code
becomes more elaborate:
Dim fDoIt As Boolean
Select Case Me!txtActivityCode
Case "EMAIL", "INCAL", "TMADJ"
fDoIt = True
Case Else
If Not IsNull(Me.txtComments.Value) Then
fDoIt = True
End If
End Select
If fDoIt Then
' ...
End If