I have a IF statement where I need to use LIKE to determin if the result set contains an e-mail address, and this is similar to the session ADMail .. the initial code I have tried with is :
UserEmailForTask = Session("ADmail")
IF objGetTaskEmailsSettings("IT_Email") LIKE %UserEmailForTask% OR Session("ADdepartment") = "IT" THEN
Dim IT_User_Tasks
IT_User_Tasks = "YES"
END IF
objGetTaskEmailsSettings("IT_Email")
can contain eigther "user1@mail.com" or have multiple emails inside it like "user1@mail.com,user2@mail.com,user3@mail.com" where I need to check if the email in UserEmailForTask
is included.
Obviously I will get a fail on %UserEmailForTask%
when using this, but how do I solve this?
The InStr function returns the position of the first occurrence of one string within another. Use it to check if the given string contains the search string:
UserEmailForTask = "..."
IF InStr(objGetTaskEmailsSettings("IT_Email"),UserEmailForTask)>0
OR Session("ADdepartment") = "IT" THEN
Dim IT_User_Tasks
IT_User_Tasks = "YES"
END IF