Subject Re: applylocate not working (success)
From Mervyn Bick <invalid@invalid.invalid>
Date Sat, 8 Jun 2024 17:43:54 +0200
Newsgroups dbase.getting-started

On 2024/06/08 16:59, Charlie wrote:
> Thanks so much for everyones help.  I think the problem was having single parenthesis around tid.  Here is the solution:function
>
>   COMBOBOX4_onChange()
>            co = form.coins1.rowset
>                 co.locateoptions := 3
>            tgrade = trim(form.combobox4.value)
>                 tid = trim(form.entryfield5.value)
>                 tcat= trim(form.combobox2.value)
>                 co.applylocate( "year= '" + tid + "' and category= '" + tcat + "'")
>                 form.entryfield1.value = val(co.fields["&tgrade."].value)
>                 return


One of our local TV channels is rerunning a 30yr old series called "The
A Team".  (They're too broke to buy new material but how that came about
is material for a whole new series in it's own right. :-) )  The main
character's favourite saying is "I love it when a plan comes together."
That seems to be appropriate now.

As it stands, if a record isn't found, the value for the last record in
the table will be shown in entryfield with no indication that this isn't
from the correct record. It is perhaps a good idea to let the user (you
:-) ) know that the search was not successful.

COMBOBOX4_onChange()
    co = form.coins1.rowset
    co.locateoptions := 3
    tgrade = trim(form.combobox4.value)
    tid = trim(form.entryfield5.value)
    tcat= trim(form.combobox2.value)
    bFound = co.applylocate( "year= '" + tid + "' and category= '" +
tcat + "'")
    if bFOund = true
       form.entryfield1.value = val(co.fields["&tgrade."].value)
    else
       form.entryfield1.value  = ''
       //make the entryfield blank other wise it will show
       //the value for the last record
       mssgbox('Record for year '+tid+ ' and category '+tcat+' not
found.')
    return

Mervyn.