Hi Folks - Currently, I am using the Error Event of my form to capture
duplicate key entry. However, this is not invoked until the form updates. Is
there a way to check for a duplicate after the user tabs out of the primary
key field? Thanks.

Signature
Michael Laferriere
HomeKey
401-921-2450
www.homekeyinc.com
Klatuu - 01 Nov 2007 23:22 GMT
Use the Before Update event of the primary key field to look for an exiting
entry. If it is found, you can present a warning an cancel the event:
Private Sub PrimaryField_BeforeUpdate(Cancel As Integer)
If Not IsNull(DLookup("[PrimaryKeyFieldName]", "TableName",
"[PrimaryKeyFieldName] = " & Me.PrimaryField)) Then
MsgBox "Duplicate Entry Found"
Cancel = True
End If

Signature
Dave Hargis, Microsoft Access MVP
> Hi Folks - Currently, I am using the Error Event of my form to capture
> duplicate key entry. However, this is not invoked until the form updates. Is
> there a way to check for a duplicate after the user tabs out of the primary
> key field? Thanks.
Jeff Boyce - 01 Nov 2007 23:42 GMT
Michael
Already answered in one of the other newsgroups you posted this (separately)
to. If you post repeatedly, none of the posts (and none of the responses)
are connected, so you waste your time/energy looking through all the places
you posted, and the time/energy of the folks who volunteer here.
If you must post to more than one group (hint: rarely necessary), select the
multiple groups in the "To:" section, rather than posting separately.
Regards
Jeff Boyce
Microsoft Office/Access MVP
> Hi Folks - Currently, I am using the Error Event of my form to capture
> duplicate key entry. However, this is not invoked until the form updates.
> Is there a way to check for a duplicate after the user tabs out of the
> primary key field? Thanks.