[AccessD] No Duplicates

Hollis, Virginia hollisvj at pgdp.usec.com
Tue Aug 7 12:25:16 CDT 2007


I am trying to check for duplicates when a user enters data in the
primary key. I don't want them to be able to enter the data in the field
at all. The ContainerNo is a txt field. I think I am missing a quote or
is this wrong all together?

 

Virginia

*********

Private Sub ContainerNo_AfterUpdate()

 If Not IsNull(ContainerNo) Then

    If DCount("ContainerNo", "tbl_Containers", "ContainerNo = " &
[ContainerNo]) > 0 Then

        MsgBox "You have entered a Container that already exists"

        ContainerNo.SetFocus

        ContainerNo.Undo

    End If

End If

End Sub




More information about the AccessD mailing list