Subject Re: Form to Form
From Peter <phb2020@hotmail.com>
Date Thu, 15 Jun 2023 13:08:08 -0400
Newsgroups dbase.getting-started

Peter Wrote:

FIXED!!
Mervyn, your suspicion that the indexname in editpattest had not been set was absolutely correct. Also the removal of all those extra requery() statements.
So here is the edited function that sets the indexname="pat_no".
Now I can to on to add all thopse other suggestions about keeping user hands off the mouse and use the keyboard as much as possible.  OnKey functions and others.
With sincerest thanks to you and others who have chimed in with programming expertise.

Peter


        function PBGOEDIT_onClick
                private cpat_no
                store "" to cpat_no
                                //patient1 is name of main program query
                cpat_no = form.patient1.rowset.fields["pat_no"].value                
                                //query1 is name of editpattest program query
                form.editpattest.query1.rowset.indexname = 'pat_no'
                form.editpattest.query1.rowset.findkey(cpat_no)
                form.editpattest.mdi = false
                form.editpattest.readmodal()
                return


Mervyn Bick Wrote:

> 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.
>