View Full Version : Can you do validation from tables using code


paulmcdonnell
08-17-2001, 08:01 AM
Hi Access Nutters...


I want my code to chech if a feild is one of a list of items.... I can set it up using 'IF's but the criteria can change over time. What would be good is if I could check the field against a table. I'm not so sure how to go about this ... has anyone done this before...Any help would be ace

cheers

Paul

Jack Cowley
08-17-2001, 09:59 AM
I am not sure what you mean by the Criteria can change over time, but you could use something like this:

If Not IsNull("[LookupField]","tblLookup", "[LookupField] = '" & Me![MyField] & "'") Then
Msgbox "This field exists in the table."
Else
Do whatever
End if

[This message has been edited by Jack Cowley (edited 08-17-2001).]