×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Access 97 duplicate record flag

Access 97 duplicate record flag

Access 97 duplicate record flag

(OP)
I am making modifications to an existing access database where there sometimes needs to be a duplicate record in a field, but I want the user to see a popup box notifying them that they are about to duplicate a record and allowing user to continue. How do I do this?

RE: Access 97 duplicate record flag

As far as your table is concerned, dups are allowed so the field cannot be a primary key and, if indexed, must allow dups.

Assuming you are using a form for data entry, add code to the form's BeforeInsert event that checks the table for the value. You will have to work with VBA code & data objects. The following example should point you in the right direction:


Dim dbs As Database, rsProcStat As Recordset
Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM tblProcessStats " _
& "WHERE ((ProcName)=""" & strMsg & """)"
Set rsProcStat = dbs.OpenRecordset(strSQL)

If rsProcStat.EOF Then
Else
intReturn = MsgBox "Duplicate value, continue?", vbOKCancel
If intReturn = vbCancel Then
Cancel = True
exit Sub
End If
End If

Set rsProcStat = Nothing
Set dbs = Nothing

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close