hello to all
I am using code behind a command button that attempts to save a record in one table (tblA) to another (tblB).
tblB has an autonumber ID and 20 records (I1, I2, ...I20) that can hold integer values. These 20 integer records are from tblA.
Here's my problem. I don't want to allow the save to tblB if the set of 20 integer values already exists in tblB. I've tried setting a pk on the combination of all 20 fields, but this would fail because some of the fields may be null.
I could actually get this to work properly using a very large DCount expression (in a BeforeUpdate event) whose 'WHERE' part compares all 20 fields in both tables, then stops the save where DCount > 0. But, this seems excessively complicated.
Is there an easy way to ensure that records (that may include null fields) are not duplicated? I feel like I'm missing something obvious.
thanks for any assistance
Vicky C.
I am using code behind a command button that attempts to save a record in one table (tblA) to another (tblB).
tblB has an autonumber ID and 20 records (I1, I2, ...I20) that can hold integer values. These 20 integer records are from tblA.
Here's my problem. I don't want to allow the save to tblB if the set of 20 integer values already exists in tblB. I've tried setting a pk on the combination of all 20 fields, but this would fail because some of the fields may be null.
I could actually get this to work properly using a very large DCount expression (in a BeforeUpdate event) whose 'WHERE' part compares all 20 fields in both tables, then stops the save where DCount > 0. But, this seems excessively complicated.
Is there an easy way to ensure that records (that may include null fields) are not duplicated? I feel like I'm missing something obvious.
thanks for any assistance
Vicky C.