Subject Re: Form to Form
From Akshat Kapoor <>
Date Sat, 13 May 2023 18:34:04 +0530
Newsgroups dbase.getting-started

Good Evening Peter,

> I am away without my computer ( a treat to myself).so I can抰 test anything.
Enjoy your holidays.

> Some clarification for some your questions:
> The pat_no field is 5 numbers. That is the field that is ultimately responsible as unique to select any choice, not last _name+first_name, although there is an index of patienttest.dbf that is upper(last_name+first_name) with spaces and trims as has been described many times, appropriately, in your books.
> Even if user enters last_name into entryfield1 to determine order of grid, I have always wanted to use pat_no as unique field to define how later seeks are used. User has choice of entry as either last_name or pat_no, onLostFocus of entryfield1, index is selected for order in grid. After pushbutton_goto is clicked, I planned to use pat_no as the way to proceed to second form in order to edit.
> Maybe a bit wordy, but there you have it.
> I抦 a bit surprised that there isn抰 a best way to get pat_no from firm1 to form2. These 2 forms use the same dbf.

Forms by default are designed to be separate entities and not to
interfere in each other.

If they are not separate then imagine navigating in one form causing
navigation in another form. A nightmare.

So the best approach is current approach. Keep them separate and then
programmer can design communication.

Ken has given you specific sections in his books. Please go through them.

Some ways I use.
(Assuming pat_no is the unique field. It is visible to end user or not
hardly matters)

in form 1

do form2 with xyz

In form2 you will have to modify the header.
(A piece of code I am using)

parameter bModal
local f
f = new aselectform()
if type('bModal') = 'C'
        f.mhead = upper(bModal)
        f.mhead = " "
f.mdi = false // ensure not MDI
release f
** END HEADER -- do not remove this line

In the form_onOpen event I check for form.mhead and proceed accordingly.

In essence I am creating a custom property of the form mhead

The other way of creating a custom property is

set procedure to form2.wfm
f2 = new form2form()
f2.mhead = "xyz"

In both the cases the form_onOpen will be handling the processing.
The coding there is important.