Subject |
Re: Form to Form |
From |
Peter <Phb2020@hotmail.com> |
Date |
Sun, 11 Jun 2023 10:46:54 -0400 |
Newsgroups |
dbase.getting-started |
Peter wrote:
Thank you, Lee, for your input. Somewhere in prior replies, I was advised NOT to use the same query in main and child forms. I was going to ask about that because, in one of Mervyn’s recent replies, he used the same query name (Customers1). If you check Function Pushbutton_onClick from 6/2/23, Mervyn shows exactly how he coded the passing of pat_no value from grid to edit form. But….
You have discovered the precise problem I was having. If you select the first row in main form (Harry Potter), the edit form opens correctly. However, if you select any other person, either by pat_no or last name, the edit form opens with new pat_no but uses first row information to display datalinked entryfields in edit form. The rowset is not changed.
It was this issue why Mervyn was advising me to sent all the code so he could debug.
Peter
Lee Grant Wrote:
> Peter,
>
> Might I suggest, that if you're going to go with a query on each form
> separate, then maybe you need to use a variable created on_Open for the
> first form, that will hold the chosen variable via your grid form, which
> can then be accessed by your second form query, to use to select from
> that query....if this is the way you want to go.
>
> The way I did my forms, was to make the first form the dominant, and it
> allowed the child the access the query on that first form when it opened
> the second by putting the results of the query from the first form, into
> the entryfields of the child form in the datalink for those entryfields.
>
> You seem to be trying to use the first form as a selection process, and
> then use that to find the right record in the second form via a
> completely new query.
>
> If you understand what I'm saying, try to think how to plumb the code to
> make this happen. Doing it your way, I'd use the on_Open() event in the
> Gridmervyn.wfm and create at least a property _app.cpat_no, so when the
> the grid selection is made, the selection from that pat_no is copied
> into that _app.cpat_no. When you open the form Editpatmervyn.wfm, have
> it's on_Open() event method check the _app.cpat_no to retrieve that
> number to use to find and select to fill the form's fields with the
> appropriate datalinks in from that query rowset.
>
> Lee
>
> On 6/10/2023 11:41 AM, Peter wrote:
> > Peter wrote:
> > As you requested I am attaching the 2 forms, an edited dbf with mdx and dbt files. I hope all this will fit in the attachments area.
> > Please excuse my using "Mervyn" for the files! I do like the "Harry Potter" series, so the patients are obvious. All data has been made up and represent no known persons.
> > Peter
>
>
|
|