Subject Re: spinbox
From Mervyn Bick <invalid@invalid.invalid>
Date Wed, 19 May 2021 08:54:39 +0200
Newsgroups dbase.getting-started

On 2021/05/19 03:33, Charlie wrote:
> I am having problems withe the following code:
>
> function PUSHBUTTON1_onClick()
>         a = form.auctopen1.rowset
>         m = form.master1.rowset
>         cEbay = form.spinbox1.value
>         if lennum(form.spinbox1.value) > 11

lennum() is not the correct function to use here.

          if form.spinbox1.value >= 100000000000

>            a.findkey(cEbay)
>                 msgbox( ""+cEbay )
>                 if not a.findkey(cEbay)
>                    //a.first()
>               msgbox( "success" )//do stuff
>                 else
>                    msgbox( "Failed entry! "+cEbay+ " is a duplication." )
>                    return
>                 endif
>         else
>            msgbox( "Failed entry! "+form.spinbox1.value+" entry must have 12 digits in Ebay number." )
>            return
>         endif
>
> I don't think I have ever done a findkey on a numeric field before.  Seems like it comes back with decimals.  I am trying to force idno to not duplicate.  The problem is this isn't working correctly.  Seems to force decimals where the field doesn't allow decimals.  Is there a secret to findkey using numbers?  The code isn't finished yet.  I just want to get past this before giving it finishing touches.  Thanks for any help.
>

I'm afraid I can't duplicate this.  Findkey() works for me both with
integers and decimal values.

You can try try changing the field type for the eBay number from numeric
to Long.  This will ensure that the numbers are stored as integers.
(Make a backup first.)  Delete the index and remake it.

Mervyn.