Foriegn key questions

  • Thread starter Thread starter Dale Osburn
  • Start date Start date
D

Dale Osburn

I have two forms, 1 for patient information and 1 for
notes that are linked via a patientID in a 1 to many
relationship. I have a command button in the form for the
patient form that opens the notes form. However when i
enter in a new notes record it does not automatically
create the foriegn key to link to the patient record. If i
create this a subform it works fine, however due to the
potential number of notes for each patient i do not want
that form to be a subform.
 
Hi,
Pass the patientId in the OpenArgs argument the DoCmd.OpenForm
(which is how I assume you open the notes form)
and then populate the field that way.
 
due to the
potential number of notes for each patient i do not want
that form to be a subform.

Um? Why not? A Continuous subform can scroll to display thousands of
records. Dan's suggestion will work, of course, with a bit of code,
but I don't see that it buys you anything!
 
Hi,
Like this:
DoCmd.OpenForm "NameOfForm",,,,,,Me.patientId

Then in the Open event.....
Me.NameOfControl = Me.OpenArgs

You probably have also have something in the WhereCondition argument of
OpenForm as well.
 
Thanks Dan

-----Original Message-----
Hi,
Like this:
DoCmd.OpenForm "NameOfForm",,,,,,Me.patientId

Then in the Open event.....
Me.NameOfControl = Me.OpenArgs

You probably have also have something in the WhereCondition argument of
OpenForm as well.

--
HTH
Dan Artuso, Access MVP





.
 
Back
Top