PLEASE HELP SIMPLE QUESTION

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

I have two tables, TBL1 and TBL2 both with the primary key
called, mach_id. I have a YES/NO field in TBL1 that I
want to be checked if that specific mach_id is present in
TBL2. If the mach_id is not present in TBL2 I do not want
a check. Does anyone know how to do this? TIA
 
I get an error messege that says Undefined function IF
-----Original Message-----
Rick said:
I have two tables, TBL1 and TBL2 both with the primary key
called, mach_id. I have a YES/NO field in TBL1 that I
want to be checked if that specific mach_id is present in
TBL2. If the mach_id is not present in TBL2 I do not want
a check. Does anyone know how to do this? TIA

This is a bad design. Instead of trying to store this in TBL1 you can set up a query
that will give the desired results and then not have to worry about constantly
updating TBL1 any time changes occur in TBL2.

SELECT TBL1.mach_id, IIf(IsNull([TBL2]![mach_id]), False, True) AS InTable2Test
FROM TBL1 LEFT JOIN TBL2 ON TBL1.mach_id = TBL2.mach_id


.
 
Back
Top