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

Foreign Key 1

Status
Not open for further replies.

Ajwebb

MIS
Joined
Jul 31, 2003
Messages
153
Location
GB
I have a one-to-many database.
The first table is Learner Dataset and the second is Learning Programme Dataset.
My Primary key fields are [Learn_id], [Provi_id].

On my main form the control source is the Learner Dataset, and what i want is a button that when clicked will allow me to add a new record to my Learning Programme Dataset Form.

However when i try this my foreign key fields do not update on the Learning Programme Dataset form.

Any ideas what i should be doing?

Sorry if i have not given enough detail.

TIA

Anthony
 
Anthony,

This needs to be done with code. Show the code under the new record button and I will write the code to do the update. Show the pertainent fields also.


Rollie E
 
Ok bare with me please.

Learner Dataset - one-to-many - Learning Programme Dataset

Primary Keys: Foreign Keys:
Learn_id Learn_id
Provi_id Provi_id

All i have at the moment is my main form and a form called Learning Programme Dataset form that is not currently linked and just floating there. It is not linked in anyway at the moment as i am unsure weather i need to use a query or if it is ok to just get the data straight from the Table.

Do i need to use a query to link the two?

TIA
 
Tell me about your tables.

Rollie E
 
hi Anthony.

in the form load procedure of your Learning Programme Dataset Form enter something like this:

me.ForeignKeyFieldNameasitappearsonform.value = Forms!NameofFirstForm!PrimaryKeyFieldNameasitappearsonform.value

so if the name of the field on the 1st form is Primary_ID,
and the name of the field on the 2nd form is Foreign_ID the example would look like this:

me.Foreign_ID.value = Forms!NameofFirstForm!Primary_ID.value


hope this helps you.
 
Thanks cghoga, i will give it a try.

Ant.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top