[AccessD] Hope for the Best, Anticipate the Worst

Kostas Konstantinidis kost36 at gmail.com
Sat Jan 22 10:49:06 CST 2022


That was the point...
Now it works
Many thank's

-----Original Message-----
From: AccessD <accessd-bounces+kost36=gmail.com at databaseadvisors.com> On
Behalf Of Gustav Brock via AccessD
Sent: Saturday, January 22, 2022 6: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

Perhaps the value is numeric:

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

/gustav

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

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
/kostas


-----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

/gustav

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
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"
        Me.code_kritiki.SetFocus
        Cancel = True
 End If
End Sub

The problem is that it breaks on any value I am trying to enter Thank's
/kostas
--
AccessD mailing list
AccessD at databaseadvisors.com
https://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list