[AccessD] Hope for the Best, Anticipate the Worst

Kostas Konstantinidis kost36 at gmail.com
Sat Jan 22 11:38:59 CST 2022


Hi Rocky
Gustav gave the solution.
however I tried what you suggested and indeed the debug displayed  the error
"Run-time error '3464': Data type mismatch in..." on Dcount line
Now it works fine
Many thank's you too


-----Original Message-----
From: AccessD <accessd-bounces+kost36=gmail.com at databaseadvisors.com> On
Behalf Of Rocky Smolin
Sent: Saturday, January 22, 2022 6:48 PM
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Subject: Re: [AccessD] Hope for the Best, Anticipate the Worst

So when you get the error, what is the exact error number and description?
When you click Debug on the error box, is the MsgBox line of code
highlightedIs the When confronted with these unexplained errors I often try
things that should make no sense but sometimes give a clue.

Did you try to replace the IF with Msgbox to see what value of Dcount is
being returned?

If the Dcount is not working then:

Dim a variable as variant, set the variant = Me!code_kritiki.Value and use
the variant in your Dcount.  Shouuld make NO difference but...well...you
know...Access...

Else

Replace your MsgBox with a simple MsgBox "!".  Again, should make no
difference, but.

Are you expecting the value in Me!code_kritiki.Value to be numeric or are
you trying to cover the case where the user has entered a non-numeric value?
If so, then I would place a first test before the DCount -  Not
IsNumeric(Me!code_kritiki.Value)  and if the value is not numeric give an
error message and exit.  That would siimplify the SCount.

r


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

> HI Rocky,
> No error... It just  displays always the message Something like it 
> doesn't recognize any entering value /kostas
>
> -----Original Message-----
> From: AccessD <accessd-bounces+kost36=gmail.com at databaseadvisors.com> 
> On Behalf Of Rocky Smolin
> Sent: Saturday, January 22, 2022 6:13 PM
> To: Access Developers discussion and problem solving 
> <accessd at databaseadvisors.com>
> Subject: Re: [AccessD] Hope for the Best, Anticipate the Worst
>
> 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
> >
> --
> 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
>
--
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