[AccessD] Hope for the Best, Anticipate the Worst

Kostas Konstantinidis kost36 at gmail.com
Sat Jan 22 09:53:06 CST 2022

HI Gustav,
Thank's for the quick response
It doesn't work
It just do the same. Any value I try to enter it breaks on MsgBox's message

-----Original Message-----
From: AccessD <accessd-bounces+kost36=gmail.com at databaseadvisors.com> On
Behalf Of Gustav Brock via AccessD
Sent: Saturday, January 22, 2022 3:40 PM
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Cc: Gustav Brock <gustav at cactus.dk>
Subject: Re: [AccessD] Hope for the Best, Anticipate the Worst

Hi Kostas

Reduce it a little:

If DCount("*", "st_kritiki", "code_kritiki = '" & Me!code_kritiki.Value &
"'") > 0 Then
    Cancel = True
End If


Fra: Kostas Konstantinidis<mailto:kost36 at gmail.com>
Sendt: 22. januar 2022 14:16
Til: 'Access Developers discussion and problem
solving'<mailto:accessd at databaseadvisors.com>
Emne: Re: [AccessD] Hope for the Best, Anticipate the Worst

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
    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 Thank's

AccessD mailing list
AccessD at databaseadvisors.com
Website: http://www.databaseadvisors.com

More information about the AccessD mailing list