Question Foreign key from primary key selection

yazink

New member
Joined
Mar 6, 2010
Messages
3
Programming Experience
Beginner
As an outline, in my application I have two tables - the first table contains Staff details and the second table contains Position details. Staff have Positions so a relationship exists (the Positions table is the parent as there can be many staff relating to it). The position table has two attributes, Position ID (PK, integer) and Position Description (Varchar). Amongst other attributes, the Staff table includes an FK integer attribute referencing to the Position ID PK in the Position details table.

I have created a form to allow users to insert new staff. Rather than requiring users to select from the FK integer values in the Staff details table I've added a drop down box which includes all of the related Position Descriptions from the Positions table in a drop down box (ie no reference is made to the FK integer in the Staff details table).

Where I'm stuck now is how I go about updating the Staff details table with the correct FK value based on the selected Position Description. I've tried using LINQ to perform a select statement but am not able as I'm using an MS Access database. I've also considered using SQL but it's fairly confusing. Is there a simple way of doing it? It seems to me that everyone using a relational database would want to be able to do this.

Sorry if the question has been asked before.

Thanks for your help,

Kevin
 
Back
Top