Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary and foreign key fun with combos and grids?
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Primary and foreign key fun with combos and grids?
Miscellaneous
Thread ID:
00673883
Message ID:
00673883
Views:
67
Sorry for the non-descriptive subject! I am having trouble with a form that gets it's data in what must be a fairly common way... I will explain...
I have a form with a grid and a combo...
My main table (contacts) contains contact information - name address etc
My second table (companies)contains companies...
My third table (links) is (what I call) a junction table - a record will have it's own primary key plus a key of a contact and a key of a company thus enabling a many to many relationship.
So I move to a contact in the contacts table then query the links table to get a list of all the companies they have links with. I loop through the links table extracting the primaries of the companies into a select in statement that queries the companies table to get the details - this populates the grid and works well.
Next I populate the rowsource of the combo with all the companies so that I have the ability for a contact to move between companies...

Here begins the problem!

I cannot successfully get the combo to display the currently selected (selected in the grid control) company name... the idea being that the user can click on the grid and it displays the company name in the combo - by changing this to another company I need to save the primary of this new company to the links table

I hope this expains well enough my scenario - I have tried different controlsource for the combo but as I say... no joy

I haven't posted code as this post is probably long enough already but will do if required...
Chris Maiden
Email
Web
Next
Reply
Map
View

Click here to load this message in the networking platform