mike60smart
Registered User.
- Local time
- Today, 14:51
- Joined
- Aug 6, 2017
- Messages
- 1,916
Hi Everyone
I am trying to use the following to check for Duplicates in a Table
The code runs and Prompts to say there is a Duplicate but when I click Ok the
data is inserted.
How would I amend the code so that it cancels the insert?
Any help appreciated.
I am trying to use the following to check for Duplicates in a Table
The code runs and Prompts to say there is a Duplicate but when I click Ok the
data is inserted.
How would I amend the code so that it cancels the insert?
Any help appreciated.
Code:
Dim strWhere As String
80 strWhere = "AcedemicYearID = " & Me.AcedemicYearID & " And StudentClassID = " & Me.StudentClassID & ""
90 If DCount("*", "tblStudentFeeYearly", strWhere) > 0 Then
100 MsgBox "Sorry, you've already entered fees for this year."
110 Me.Undo
120 End If