Please I have a Table "tblSubmission" with Field "ClNo"
I found the code on this platform which works fine when make manual entry into the textfield "ClNo" which prevent duplicate in the table "tblsubmission".
My Problem: ClNo is a concateated field which derives from three other textboxes. Because of this, the before update of ClNo doesnt work to prevent duplicate in the table
Private Sub ClNo_BeforeUpdate(Cancel As Integer)
Dim Answer As Variant
Answer = DLookup("[ClNo]", "tblSubmission", "[ClNo] = '" & Me.ClNo & "'")
If Not IsNull(Answer) Then
MsgBox "Duplicate Record, Already exist" & vbCrLf & "Please Check and try again.", vbCritical + vbOKOnly + vbDefaultButton1, "Duplicate"
'Cancel = True
Me.Undo
Else:
End If
End Sub
I found the code on this platform which works fine when make manual entry into the textfield "ClNo" which prevent duplicate in the table "tblsubmission".
My Problem: ClNo is a concateated field which derives from three other textboxes. Because of this, the before update of ClNo doesnt work to prevent duplicate in the table
Private Sub ClNo_BeforeUpdate(Cancel As Integer)
Dim Answer As Variant
Answer = DLookup("[ClNo]", "tblSubmission", "[ClNo] = '" & Me.ClNo & "'")
If Not IsNull(Answer) Then
MsgBox "Duplicate Record, Already exist" & vbCrLf & "Please Check and try again.", vbCritical + vbOKOnly + vbDefaultButton1, "Duplicate"
'Cancel = True
Me.Undo
Else:
End If
End Sub