[AccessD] Hope for the Best, Anticipate the Worst

Kostas Konstantinidis kost36 at gmail.com
Sat Jan 22 07:16:31 CST 2022

Hi guys,
I am trying to prevent duplicate data in a numeric field and I use: 
Private Sub code_kritiki_BeforeUpdate(Cancel As Integer)
'On Error Resume Next
    If DCount("*", "st_kritiki", "code_kritiki='" & Me.code_kritiki.Value &
"' and code_kritiki='" & Me.code_kritiki.Value & "'") > 0 Then
        MsgBox "Some Greek text", vbInformation, "some Greek text"
        Cancel = True
 End If
End Sub

The problem is that it breaks on any value I am trying to enter

More information about the AccessD mailing list