Perry L Harold
pharold at proftesting.com
Wed Nov 18 12:30:21 CST 2009
If you have set the Primary Key as ItemName+ItemDesc and attempt to write the record it will give you an error message at that stage. Assuming the data entry person can get it correct most of the time why not capture the error at the point of writing the record and have changes made at that point? Perry -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Hollis, Virginia Sent: Wednesday, November 18, 2009 12:51 PM To: accessd at databaseadvisors.com Subject: [AccessD] Duplicates on Two Values This gives me an error. I think because I have the text fields '''' messed up. If Not IsNull(ItemName) And Not IsNull(ItemDesc) Then If DCount("ItemName", "tbl_ItemMain", "ItemName = '" & [ItemName] & "'and "ItemDesc = '" & [ItemDesc]) > 0 Then MsgBox "You have entered a ItemName and ItemDesc that already exists" ItemName.SetFocus ItemName.Undo End If End If -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com