Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Joins and Forms

Joins and Forms

Joins and Forms

Hi All,

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.

The Problem:

I have a table containing records for each person in a family.  Each record contains the index of both the father and mother of the person (self-referencing indexes).  The records also contains two more indices, both indexing into a 'locations' table.

I would like to display a person's details on a single tabbed form, displaying fields from the father, mother and two locations.  I intend doing this by creating a suitable view.

I also want to display a list of the current person's children in a grid on the form.  The view entries will form the 'one' end of a one-to-many relationship with the base table being used for the children.

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

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?

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.  However any advice stated in you own words I'm sure will be of more help.

Thanks Andy.

RE: Joins and Forms

The View Designer cannot handle very complex joins, though VFP6 is better than its predecessors.  You'll have to create the view programmatically using the CREATE VIEW command.  You will be able to create an updatable view in this way as well.

Robert Bradley

FoxDev - Visual FoxPro Development

RE: Joins and Forms

Thanks Robert,

I think I'm on the right track now.  Having to use DBSETPROP() to get the updates working is also making sence to me now (being essentially a C++ developer).  The FoxPro Designers are far too nice for people like myself!

Many Thanks Andy.

RE: Joins and Forms

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.

RE: Joins and Forms

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.

RE: Joins and Forms

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close