So I have 2 tables and I want to Insert only 1 value into my second table as long as it doesn't exist.
So if 'LeaseID' in table1 = 201 then I want to insert 'LeaseID' into table2 only if the value 201 does not exist in table2. If it does exist then my statement should "attempt to update 0 records" if ran.
How do I write that WHERE clause? I pasted what I was attempting to make work below.
Thank you very much!
INSERT INTO tbl_Renter ( LeaseID ) SELECT tbl_Lease.LeaseID FROM tbl_Lease WHERE (((tbl_Lease.LeaseID)=[forms]![frm_Lease].[leaseID])) And tbl_Renter.LeaseID!=forms!frm_Lease.leaseID;
So if 'LeaseID' in table1 = 201 then I want to insert 'LeaseID' into table2 only if the value 201 does not exist in table2. If it does exist then my statement should "attempt to update 0 records" if ran.
How do I write that WHERE clause? I pasted what I was attempting to make work below.
Thank you very much!
INSERT INTO tbl_Renter ( LeaseID ) SELECT tbl_Lease.LeaseID FROM tbl_Lease WHERE (((tbl_Lease.LeaseID)=[forms]![frm_Lease].[leaseID])) And tbl_Renter.LeaseID!=forms!frm_Lease.leaseID;