Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Errors arising from using two forms where the parent cursor in one form is a child cursor in another

Status
Not open for further replies.

Al_7491

Programmer
Apr 10, 2017
2
PH
Please help...

I created the main form "Dog Registry" with parent cursor "Owners" and a child grid with cursor "Dogs_Owned". In the form I added a command button "Vaccination Details" to call a subsidiary form "Vaccination Data". The subsidiary form has a parent cursor "Dogs_Owned" and child grid cursor "Vaccination_details". Both forms were created using the form wizard. At run time, the forms initially perform as expected, but after adding a few records, child grid record details in the main form will unexpectedly appear in the supposedly blank grid for newly added owner. Sometimes, previously added child grid records will unexpectedly scroll up out of view when a new record is added. Things get back to normal after I close the form and run it again. What went wrong and how to correct it? Thanks.
 
First thing to change:
Both forms were created using the form wizard.
It is HIGHLY recommended that you DO NOT build VFP Forms using the Form Wizard.
* First of all it removes many opportunities for you to Learn how to build Forms.
* Next, wizards build in their own code because 'THEY' think that you want/need it and many times you do not. In fact that code often gets in the way.

Next, lets consider re-architecting your Data Table(s).
For good data Normalization you should have a number of separate data tables.
For example:
Code:
Dogs
Owners
Vaccinations

For your Forms, you would bring together data from these various forms via SQL Queries. And these query results can each be viewed in Form Grids.

There are a number of 'unknowns' regarding your application needs, but first you might consider how your project is designed as a whole.

Good Luck,
JRB-Bldr





 
One possible cause of this problem might be the setting of the respetive forms' DataSession property - although it's hard to know for sure without having more information, especially about how (and where) you have created your cursors. If you are not famliar with how data sessions work, you might like to read up on the subject in the VFP Help.

That said, I completely agree with JRB about the consequences of using the form wizard. The wizard creates a lot of code, most of which is un-commented, and it can be difficult to understand what it is doing. If you create your own forms, on the other hand, you would have better control over them and would understand better what is going wrong.

Mike
P.S. Welcome to the forum.

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thanks jrbbldr and Mike. Tables are already separate. I'll rework the forms. Thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top