Good Morning,
Thanks for allowing me to join your community.
The issue I have is with a piece of code that identifies duplicate entries in a name field and the takes me to the duplicated record.
This works great until I have a name that has an apostrophe in it, would anybody be kind enough to point me in the right direction for dealing with this.
Code:
'*********************************'Code sample courtesy of srfreeman
'*********************************
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
SID = Me.fullname.Value
stLinkCriteria = "[fullname]=" & "'" & SID & "'"
'Check StudentDetails table for duplicate StudentNumber
If DCount("fullname", "tbl1Employees", _
stLinkCriteria) > 0 Then
'Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Warning Employee Name " _
& SID & " has already been used." _
& vbCr & vbCr & "You will now been taken to the record.", _
vbInformation, "Duplicate Information"
'Go to record of original Student Number
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing
Any guidance would be much appreciated
Have a good day