My code is as follows:
If (InStr(1, "ALL", Itype) Or InStr(1, Uvar.Device, Itype) _
And (InStr(1, "ALL", Isec) Or InStr(1, Uvar.Sec, Isec)) _
And (InStr(1, "ALL", Idev) Or InStr(1, Uvar.Model, Idev)) Then Useline = "TRUE"
To expand on this a bit:
Itype is a long string, e.g. -
Itype = All, Apple, Pear, Orange
Isec = dog, cat, duck
Idev = tree, flower, plant
Each UVar.x is a single word, e.g. -
UVar.Device = Apple
UVar.Sec = Cat
UVar.Model = tree
So, if Itype contains the string "All" or it contains the value of UVar.Device and Isec also contains the string "All" or it contains the value of UVar.Sec and IDev also contains the string "All" or it contains the value of UVar.Model
then I want to have the if statement = true
.
My code above seems to return true whatever values are used, as long as at least one value criteria set matches.
Thus, do the strings IType, Idev and Isec each contain either the value "all" or a specific user defined value?