Originally Posted by
merebag
I just need to check a variable against a set of numbers to make sure it is not in that set.
I understand that. If it's a simple string, you could probably use the Find function. If it's an actual array, you have to split the elements then loop through them. Array has a different meaning in Access than it does for mathematics. The former is an actual object in memory. The latter can be considered a string for Access purposes.
If you want to use a db type of array (one dimensional), this is about the simplest method I've seen, which you can find here
http://stackoverflow.com/questions/1...ng-in-an-array
Code:
Sub Test()
Dim arr As Variant
arr = Split("abc,def,ghi,jkl", ",")
Debug.Print IsInArray("ghi", arr)
End Sub
Function IsInArray(stringToBeFound As String, arr As Variant) As Boolean
IsInArray = (UBound(Filter(arr, stringToBeFound)) > -1)
End Function