[AccessD] Prevent Duplicates

Hollis,Virginia HollisVJ at pgdp.usec.com
Thu Apr 22 09:02:35 CDT 2004


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



More information about the AccessD mailing list