View Full Version : Lookup value from other table ONLY IF there's a match


scrooge4277
03-13-2007, 01:42 PM
Hi All,

There are two tables of interest in this problem, [Product] and [Status]. [Product] has several thousand records while [Status] holds information that applies to only a few hundred of these records. Both tables have fields refering to ID. I'd like to write a script that will try to match an ID from the [Product] table to its match on the [Status] table. If there's a match, i'd like it to return the "Status" field and if there's not, i'd like it to return the string "No Status Items."

I've tried playing with the Dlookup command but i can't get it working for some reason. Any ideas?

Thanks.

pbaldy
03-13-2007, 01:51 PM
DLookup() should work, combined with an nz() to account for the Null it will return if there's no match.