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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Joins and Forms

Status
Not open for further replies.

andyk

Programmer
Jul 29, 2000
24
GB
Hi All,<br><br>I've posted a similar question previously on the FoxPro Forum, with your help (thanks David and John!) I've managed to get a bit further, but I am still not quite there, so a bit more help would be gratefully received.<br><br>The Problem:<br><br>I have a table containing records for each person in a family.&nbsp;&nbsp;Each record contains the index of both the father and mother of the person (self-referencing indexes).&nbsp;&nbsp;The records also contains two more indices, both indexing into a 'locations' table.<br><br>I would like to display a person's details on a single tabbed form, displaying fields from the father, mother and two locations.&nbsp;&nbsp;I intend doing this by creating a suitable view.<br><br>I also want to display a list of the current person's children in a grid on the form.&nbsp;&nbsp;The view entries will form the 'one' end of a one-to-many relationship with the base table being used for the children.<br><br>In order to be able to update the fields in the view, I believe I need to create the view in the designer (is it possible to create a bit of SQL programmatically and set it so that the base takes are updated as you can in the designer?).<br><br>I'm sure its possible to produce a suitable view in the designer, however I don't seem to be having much luck - can anyone suggest the correct joins?<br><br>I have printed out the complete set of Help from Visual FoxPro 6.0 so if you want to refer of to that please do.&nbsp;&nbsp;However any advice stated in you own words I'm sure will be of more help.<br><br>Thanks Andy.<br><br><br><br>
 
The View Designer cannot handle very complex joins, though VFP6 is better than its predecessors.&nbsp;&nbsp;You'll have to create the view programmatically using the CREATE VIEW command.&nbsp;&nbsp;You will be able to create an updatable view in this way as well. <p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br>
 
Thanks Robert,<br><br>I think I'm on the right track now.&nbsp;&nbsp;Having to use DBSETPROP() to get the updates working is also making sence to me now (being essentially a C++ developer).&nbsp;&nbsp;The FoxPro Designers are far too nice for people like myself!<br><br>Many Thanks Andy.
 
In the data environment of the form you can have many cursor pointed to the same table with different orders , just use different alias, you can set the alias in the alias properties of the cursor
If you are working with SQL you have to make the viewers and point the cursor inside the from to that viewer or your can create the cursor inside the ini. property of the form.
 
Thanks, sounds like sound advice. Can I just comfirm that what you are suggesting si neat way to re-order views? My original query was really about how to build complex views in the Studio and display the result in forms.

I'll try what you have said, but due to by inexperience, I am unsure of its benefit. Is it a performance thing?

Back to my original problem, I've got the view working interactively now, and the initial population of the form is working fine, however when I skip to the next (second) record I get Error 10's for each of my edit controls. I'm assmming my view has gone out of scope in somehow but cannot determine why. Can anyone help?

Thanks Andy.
 
Sorry, problem solved - I had some combo boxes being populated from other tables. I'm not sure what was wrong but I've re-done them and all it fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top