Subject Re: Form to Form
From Mervyn Bick <invalid@invalid.invalid>
Date Sat, 10 Jun 2023 11:49:02 +0200
Newsgroups dbase.getting-started

On 2023/06/09 20:23, Peter wrote:
> Peter wrote:
>
> Thank you for these wfm's.  I was not able to create the tablename as you wrote.  Rather than debugging, I copied and pasted into my wfm, changing names as needed, at least until there were no errors that popped up.
> The problem is that, for some reason, the findkey() does not move the rowset to the selected pat_no in the editpattest.wfm, that was instantiated earlier.
>
> I am copying the PBGOEDIT_onClick with some msgbox() results.
> I hope you can help solve this problem.
> With thanks,
> Peter
>
>         function PBGOEDIT_onClick
>                 private cpat_no,clname
>                 store "" to cpat_no,clname
>                                 //patient1 is name of main program query
>                 cpat_no = form.patient1.rowset.fields["pat_no"].value                
>                 msgbox("cpat_no: "+cpat_no)                //this shows CORRECT pat_no
>                                 //query1 is name of editpattest program query
>                 form.editpattest.query1.rowset.findkey(cpat_no)
>                 form.editpattest.query1.requery()        //this made no difference
>                 clname = form.editpattest.query1.rowset.fields["lname"].value
>                 msgbox("clname: "+clname)        // this shows Last Name of rowset.first()
>                                 //there is no change in rowset in "findkey(cpat_no)" above
>                 form.editpattest.mdi = false
>                 form.editpattest.readmodal()
>                 return


Debugging a form without being able to run it becomes nothing more than
a guessing game. :-(  My best guess at the moment is that you haven't
set an index for the rowset in your editpattest form.  The index needs
to be on the pat_no field.

Mervyn.