Populating Form 2 Foreign Key Control with Primary Key from form 1

Hargo

Registered User.
Local time
Today, 11:31
Joined
Sep 4, 2014
Messages
19
Hi folks

I am trying to get the Primary Key value from one form to auto-populate the foreign key value of a second form


I have tried the following code in both the second form's Load Event and the Foreign Key Control Got Focus Event but nothing doing...

Me.[NHS Number] = Forms![frm_Patient_Data_Entry]![NHS Number]


I am new to VBA so not sure of the referencing technique but have looked at the MVPS Form 'referencing' sheet to no avail.

I keep getting an error message (2450) MS Access cannot find the referenced form "frm_Patient_Data_Entry"

I have checked spelling throughout countless times so there must be something wrong with my referencing I guess

Any suggestions gratefully received

Thanks
 
Hi jdraw

Admissions is NOT a subform of Patient because it has tab control with three pages and has its own subform on page 1

I am unable to insert links etc due to low post count but in any case cannot zip

(file size is 179kb - is this too big?)

Patient table has a 1 - Many relationship with Admissions table to allow patients to be admitted more than once - NHS Number is Primary Key in Patient Table / Foreign Key in Admissions Table

Thanks
 

Users who are viewing this thread

Back
Top Bottom