[AccessD] Prevent Duplicates

paul.hartland at fsmail.net paul.hartland at fsmail.net
Thu Apr 22 09:27:30 CDT 2004


Virginia,
I think as your processing this on the AfterUpdate event you need to change the line to read
If DCount("VenNumber", "tbl_Vendor", "VenNumber = " & [VenNumber]) > 1
Paul





Message date : Apr 22 2004, 03:07 PM
>From : "Hollis,Virginia" 
To : "'accessD at databaseadvisors.com'" 
Copy to : 
Subject : [AccessD] Prevent Duplicates
I need a way to check if a vendor number is a duplicate entry. On the
AfterUpdate of VenNumber I placed the below code, but it produces an error
about not finding the Automation Object and gives the entry I made in the
VenNumber field. VenNumber is a text field - do I have the quotes or
parenthesis wrong?

Virginia

************************
If Not IsNull(VenNumber) Then
If DCount("VenNumber", "tbl_Vendor", "VenNumber = " & [VenNumber]) > 0
Then 
MsgBox "You have entered a Vendor Number that already exists"
VenNumber.SetFocus
VenNumber.Undo
End If
End If
-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
Join the UK's number one for the internet 
www.freeserve.com/time


More information about the AccessD mailing list