Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2007

Tip: Looking for answers? Try searching our database.

Capture Duplicate Key After Update of Text Box Instead of Form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael - 01 Nov 2007 22:23 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.