Subject beginappend() Problem
From Peter <phb2020@hotmail.com>
Date Tue, 27 Jun 2023 11:48:02 -0400
Newsgroups dbase.getting-started
Attachment(s) FUNCTION RB_BILLTOOTHER_onRMD.txt

I am having a problem with beginappend() which is called if user needs to enter data for sending bill to someone other than the patient.  If there a prior listing for this information, all works fine:  existing data is used for datalink of billtotest.wfm.
However, if there is no prior listing, i.e. no rowset for patient ID, form.rowset.beginappend() does not present user with a blank form.  (Based on OLH, I used beginAppend() Example to carry over to the billtotest.wfm.  This does not work.)

Of interest is that msgbox for rowset.state is 1 (browse), not 2 (edit) in the first circumstance where prior rowset is found by findkey().
If there is no rowset found for existing data, a msgbox for rowset.state does not show 3 (append), but shows 1.

So your help would be greatly appreciated.  I hope there is only a small error.
Peter



        FUNCTION RB_BILLTOOTHER_onRMD
                set procedure to billtotest.wfm
                form.billtotest = new billtotestForm()
                form.billtotest.querybill_to.rowset.indexname = "pat_no"
                if form.billtotest.querybill_to.rowset.findkey(cpat_no)
                        msgbox("Found key")                //Correct
                        form.billtotest.mdi = false
                        form.billtotest.readmodal()
                else
                        msgbox("Couldn't find key")                //Correct
                        private cbill_lname,cbill_addr1,cbill_addr2,cbill_city,;
                                cbill_st,cbill_zip,cbill_hphone
                        store "" to cbill_lname,cbill_title,cbill_addr1,cbill_addr2,;
                                cbill_city,cbill_st,cbill_zip,cbill_hphone        
                        form.billtotest.mdi = false
                        form.billtotest.readmodal()
                        form.billtotest.querybill_to.rowset.beginappend()
                        cpat_no     = form.query1.rowset.fields["pat_no"].value
                        cbill_lname = form.query1.rowset.fields["lname"].value
                        cbill_add1  = form.query1.rowset.fields["addr1"].value
                        cbill_add2  = form.query1.rowset.fields["addr2"].value
                        cbill_city  = form.query1.rowset.fields["city"].value
                        cbill_st    = form.query1.rowset.fields["st"].value
                        cbill_zip   = form.query1.rowset.fields["zip"].value
                        cbill_hphone= form.query1.rowset.fields["hphone"].value
                endif                
                //form.close() closed in billtotest_onClose
        return

        FUNCTION BILLTOTEST_onOPEN
                msgbox("rowset state in billtotest.wfm: "+form.querybill_to.rowset.state)
                                //This shows rowset.state at 1: edit
                if form.querybill_to.rowset.state == 3                //append, but rowset.state is 1
                                form.querybill_to.rowset.fields["bill_lname"].value  := cbill_lname
                                form.querybill_to.rowset.fields["bill_add1"].value   := cbill_add1
                                form.querybill_to.rowset.fields["bill_add2"].value   := cbill_add2
                                form.querybill_to.rowset.fields["bill_city"].value   := cbill_city
                                form.querybill_to.rowset.fields["bill_zip"].value    := cbill_zip
                                form.querybill_to.rowset.fields["bill_st"].value     := cbill_st
                                form.querybill_to.rowset.fields["bill_hphon"].value  := cbill_hphone
                                form.rowset.modiifer := false
                endif
                return