I have a code that seems to work randomly, sometimes ? For example, every time I test the code it works fine but still when I check I find duplicate records.
This code is to find duplicate CASE when the case number is entered (first field) a msgbox comes up to indicate that this is a duplicate case number and would I like to view this record Yes or No. If Yes then it opens up that record if No then it opens a new record with the focus on the case number field.
Now, after investigating the code, I found that in the code I did not capatilize one Case word. I never got a warning so I wasn't sure that it would be a problem, like I said, the code always worked for me but other officers enter data and When I ran a find duplicate query, I found some duplicates.
So, the code works / dosent work ???
Private Sub Case_BeforeUpdate(Cancel)As Integer
Dim strCase As String
Dim strCriteria As String
Dim intResponse As Integer
If Me.RecordsetClone.RecordCount >0 Then
If Not.NoMatch The
IntResponse = MsgBox ("THIS RECORD IS ALREADY ENTERED." & vbNewLine
& "WOULD YOU LIKE TO VIEW THIS RECORD?", vbYesNo + vbExclamation)
If intResponse = vbYes Then
Me.Bookmark = .Bookmark
Cancel = True