Tupacmoche said:
Some language have an inlist function (inlist State = 'NY', 'CT',
'NJ') is there one in Access 2003? Or is there something equivalent?
Is that function supposed to return true if State is in 'NY' or 'CT' or
'NJ'? Or is it to return the position of the matched entry?
Regardless, Access VBA doesn't have such a function, so you can't use it
in VBA code. Access SQL does have an In operator that can be used in
queries, if all you want to know is whether the item is in the list:
SELECT * FROM Addresses
WHERE State In ('NY', 'CT', 'NJ');
To get a similar effect in VBA code, I've been known to use the InStr
function:
If InStr(State, "NY,CT,NJ") > 0 Then
' it was in the list
End If
I seem to recall that you can also use the Eval function to get the In
operator to work:
If Eval("'" & State & "' In ('NY', 'CT', 'NJ')") Then
' it was in the list
End If
On the other hand, if you want the function to return the position of
the item in the list, there is no built-in function for that. Writing
one would be trivial, though.