How to pass a value from one subform to another?

Eddie

Registered User.
Local time
Today, 01:47
Joined
Jun 25, 2009
Messages
10
I have a parent form with three tabs for subforms. Each subform is attached to a table:

· "Demographics" displays a single record.
· "Appointments" displays continuous records.
· "Status" displays continuous records.

To enter a new record under "Appointments" or "Status", I use a drop-down box on the parent form to execute a small VBA script to "call up" the proper record on the "Demographics" tab first.

Each table has multiple fields including:

· Primary key "ID" field (autonumber).
· "MedRecID" field (number).

I have defined a one-to-many relationship between:

· Demographics.MedRecID -> Appointments.MedRecID
· Demographics.MedRecID -> Status.MedRecID.

When I enter a new record in the Appointments tab, it automatically fills Appointments.MedRecID with the value from Demographics.MedRecID. This is exactly what I want it to do.

However, when I enter a new record in the Status tab, it fills Status.ID with the value from Demographics.ID instead of filling Status.MedRecID with the value from Demographics.MedRecID.

I cannot figure out what I'm doing wrong here. I would greatly appreciate any pointers.
 
you can pass any value using the FULL path. (use the builder to get it correct if need)

forms!myForm1!subform!form!cbo1 = forms!myForm2!cbo2
 
It's not clear to me from your post what you mean by "automatic"...
When I enter a new record in the Appointments tab, it automatically fills Appointments.MedRecID with...
A subform control has two properties, LinkMasterFields and LinkChildFields, which control how the foreign key field is automatically entered when you add a subform record. Is that the "automatic" you are talking about, or have you implemented a custom mechanism to make this link? To me, if we are talking about linking newly added subform records without discussing LinkMasterFields and LinkChildFields, then we might have overlooked something. We should start with a discussion of those properties, and how you have them set, or why you aren't using them.
Hope this helps,
 
Perfect. I did a quick lookup on LinkMasterFields and LinkChildFields. That was my error. Fixed it and all is good. Thank you for sharing your knowledge with me!
 
You are welcome Eddie. Thanks for posting back with your success! :)
 

Users who are viewing this thread

Back
Top Bottom