Subject Re: field type binary not working on my form
From Mervyn Bick <invalid@invalid.invalid>
Date Sun, 17 Sep 2023 11:41:37 +0200
Newsgroups dbase.getting-started

On 2023/09/17 08:43, AGOSTINHO wrote:
> Dear group,
> I've made a small seek_fish.form I've applied Mervyn  advice but still the same result.
> when I scroll the grid the pictures display properly but as soon I type any character in the search entryfield  I will not be able to see the images anymore, the only thing I can  do is to  close the form than it will reset.
> Any help how to solve this problem.
> In advance thank you very much
> Agostinho
>
......>
>     function ENTRYFIELD1_onKey(nChar, nPosition,bShift,bControl)
>         form.fish41.params['ag'] = '%'+this.value+'%'
>       try
>         form.fish41.requery()
>      catch(exception e)
>         form.fish41.requery()
>     endtry
>     return
>        return

The second return is not required but it doesn't seem to upset dBASE as
removing it didn't change the way the form worked.

You didn't include the fish4.dbt file but this was not a problem as I
simply copied fish.dbf from the DBASESAMPLES folder to fish4.dbf in my
working folder.

I obviously had to change the path in the sql property of the query to
suit my computer but your form ran as it stood.  Selecting records in
the grid changed the image displayed as expected.  Typing values into
the entryfield changed the rowset but, although the image didn't
disappear, the image didn't change.  Once a new set of records had been
displayed, selecting different records in the grid didn't change the image.

Using requery() shouldn't create a new rowset in memory, it should
simply refresh the existing rowset and all the linkages to controls on
the form should still work.  This is not happening.  The solution is to
reassign the link to the image control's dataSource property after the
requery.

    function ENTRYFIELD1_onKey(nChar, nPosition,bShift,bControl)
       form.fish41.params['ag'] = '%'+this.value+'%'
       try
          form.fish41.requery()
       catch(exception e)
          form.fish41.requery()
       endtry
       form.image1.dataSource = form.fish41.rowset.fields["fish image"]
       return

Mervyn.