Subject Re: Form to Form
From Mervyn Bick <invalid@invalid.invalid>
Date Sun, 11 Jun 2023 17:36:08 +0200
Newsgroups dbase.getting-started

On 2023/06/11 16:46, Peter wrote:
> 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

I'm busy with this but having to cope with chores and load shedding cuts
down the time available.

They're not causing the problems you (and Lee :-) ) are experiencing but
there are a couple of things to be going on with.

    this.PATIENT1 = new QUERY(this)
    with (this.PATIENT1)
       onOpen = class::PATIENT1_ONOPEN
       left = 7.0
       top = 396.0
       sql = "select * from :MYTEST:patientmervyn"
       active = true
    endwith


Although your form works this is not correct when using OODML.  Placing
the database name between colons is for opening a table in a workarea in
XDML.  One should really avoid mixing XDML and OODML syntax.  It can
work but it can also easily mess things up.

    USE :MYTEST:patientmervyn

In OODML you would use a database object (which you have done) and then
assign the name of the database object to the databasename property of
the query.

    this.PATIENT1 = new QUERY(this)
    with (this.PATIENT1)
       left = 2.0
       top = 8.0
       width = 43.0
       height = 37.0
       database = form.database1
       sql = "select * from patientmervyn"
       active = true
    endwith

I don't know how much data entry you've ever had to do but I HATE having
to take a hand off the keyboard to use the mouse.  Although the user is
free to use the mouse if desired, I try to make it possible to use only
the keyboard.  (I don't always succeed. :-) )

To make your character search case insensitive you have used
UPPER(LNAME)+UPPER(FNAME) to define the index expression for the UPBOTH
index.  I've changed this to UPPER(LNAME)-UPPER(FNAME) as this moves all
the spaces in the LNAME field to the end of the index expression.  This
means that the user could type WEASLEYR  to find Ronald Weasley's
record.  With the + in the index expression the user would need to type
WEASLEY             R i.e include the exact number of spaces in the
LNAME field before entering to first character of the FNAME field.  One
space too many or one space too few and the findkey() will fail.

More, perhaps later otherwise tomorrow.

Mervyn.