PC Review


Reply
Thread Tools Rate Thread

Create a message box to avoid duplicate records

 
 
=?Utf-8?B?SmF5?=
Guest
Posts: n/a
 
      25th Jan 2007
Hello,
I am trying to create a message box to avoid creating duplicate records. I
have already change the field to be the table's primary key, but the user
will not be notified as the record being a duplicate until he/she finishes
filling out the form. I am trying to have a message box appear after they
enter the field 'cboglobalID' if duplicate. I tried using the following code
but I am getting an error message that takes me back to (If
DCount("PARTICIPANTGLOBALID", "tbl_QuotaStatusTracker", stLinkCriteria) > 0
Then). I cannot figure out what is that I am doing wrong. Please help. Thank
you

Private Sub cboGlobalID_BeforeUpdate(Cancel As Integer)

Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset

Set rsc = Me.RecordsetClone

SID = Me.cboGlobalID.Value
stLinkCriteria = "[cboGlobalID]=" & "'" & SID & "'"

'Check StudentDetails table for duplicate PARTICIPANTGLOBALID
If DCount("PARTICIPANTGLOBALID", "tbl_QuotaStatusTracker",
stLinkCriteria) > 0 Then
'Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Warning Participant Global ID " _
& SID & " has already been entered." _

End If

Set rsc = Nothing
End Sub
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to avoid duplicate records Tinkster Microsoft Access 2 30th Sep 2008 10:22 PM
How to avoid getting a duplicate message when emailing a group Ibelong? rooy Microsoft Outlook Discussion 1 22nd Sep 2008 12:43 PM
How can I join two queries and avoid duplicate records? StratfordWard Microsoft Access Queries 4 31st Jul 2008 03:35 PM
Create duplicate records Pat Garard Microsoft Access 1 11th Apr 2007 08:33 AM
How to avoid duplicate records in two queries hkgary33 via AccessMonster.com Microsoft Access Queries 1 23rd Aug 2006 04:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:33 AM.