Subject Re: beginappend() Problem
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Wed, 28 Jun 2023 14:38:56 +0530
Newsgroups dbase.getting-started

Good Afternoon Peter,

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

The issue of implicit calls etc can be a tough one to debug.

My code in this situation would be

        FUNCTION RB_BILLTOOTHER_onRMD
                set procedure to billtotest.wfm
                form.billtotest = new billtotestForm()
-                form.billtotest.my_pat_no = cpat_no
                form.billtotest.mdi = false
                form.billtotest.readmodal()
        return

        FUNCTION BILLTOTEST_onOPEN
                
                if type('form.my_pat_no') #'U'
                        your code to go to desired record or append
                endif
        return

This MAY help in avoiding implicit movement as the form is already open
and only your code will cause movement.
Give this a try.

Regards
Akshat