A question that surfaces fairly often deals with LookupEdit controls and how to do more with the LookupRestriction properties, such as add multiple conditions to the restriction. Although it is undocumented, you can do that with the existing LookupEdit – you just have to put things in the wrong place. Let’s say you want to add a restriction to a LookupEdit for all contacts with an areacode of “623” AND that have a title of “Developer”.
LookupRestrictField = "WORKPHONE" LookupRestrictOp = " LIKE '623%' AND TITLE = 'Developer' AND "1" = " LookupRestrictValue = "1"
Or you could do it like this:
LookupRestrictField = "CONTACTID" LookupRestrictOp = " IN (SELECT CONTACTID FROM CONTACT WHERE WORKPHONE LIKE '623%' " & _
"AND TITLE = 'Developer') AND "1" = " LookupRestrictValue = "1"
A few things to point out, make sure you notice the extra space at the start of the operator (ie: before “IN” or “LIKE” etc). This is needed because when the final query is constructed it just appends the three values together without spaces (so you’d get something like “CONTACTIDIN…” without the space). Also, the reason why you have to put all that in the RestrictOp property is because when the final query is constructed the RestrictValue gets enclosed in single-quotes. That is also the reason for the AND "1" = at the end.
Stay tuned to slxdeveloper.com for a more in-depth article on the subject.