[AccessD] Hope for the Best, Anticipate the Worst

Rocky Smolin rockysmolin2 at gmail.com
Sat Jan 22 10:13:11 CST 2022


I would temporarily replace IF with MsgBox to see what the dcount is coming
up with. If that looks good replace your MsgBox with a simple MsgBox "!"

When it breaks on MsgBox what is the error?

r

On Sat, Jan 22, 2022 at 7:53 AM Kostas Konstantinidis <kost36 at gmail.com>
wrote:

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