By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,290 Members | 2,425 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,290 IT Pros & Developers. It's quick & easy.

2 subforms on a form

P: n/a


Hi all

Is it possible to have 2 subforms on a form but have the second subform
linked to the 1st subform. I will explain the situation.

My form contains details of teams and the shift the team is working on a
particular day. The 1st subform contains the names of the team members.
As the user moves through the records on the main form, the team members
are updated accordingly. The 1st subform is a continuous form.

I want the second subform to show any absences for the team member
selected in the 1st subform.

I think you are all going to tell me that the 2nd subform should be a
subform of the 1st subform. However, when i tried that i got a message
saying this was not possible with a continuous form. The reason i want
the 1st subform as a continuous form is because i want the user to be
able to select more than one team member at a time and add an absence or
shift change - rather than having to do this one team member at a time.

Hope this makes sense and would be grateful for any help.

thanks
michelle

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Michelle,

There's a trick that works really well. On Subform 2, set the 'Link Child
Fields' property to the field name on the subform you're using as a link.
Now set the 'Link parent Fields' property to point to the field in Subform 1
that forms the link.
e.g.
Link Child Fields...Subform2_FieldName
Link Parent
Fields...Forms!frmMainFormName!subForm1SubformCont rolName.Form!Subform1_Fiel
dName

Note the syntax: Forms!<Main>!<SubFormControl>!Form!<FieldName> where
anything in angle brackets is a name you've given to the item in question.

All the best,

Andrew

"Michelle" <mi*************@poferries.com_NOSPAM> wrote in message
news:40*********************@news.frii.net...


Hi all

Is it possible to have 2 subforms on a form but have the second subform
linked to the 1st subform. I will explain the situation.

My form contains details of teams and the shift the team is working on a
particular day. The 1st subform contains the names of the team members.
As the user moves through the records on the main form, the team members
are updated accordingly. The 1st subform is a continuous form.

I want the second subform to show any absences for the team member
selected in the 1st subform.

I think you are all going to tell me that the 2nd subform should be a
subform of the 1st subform. However, when i tried that i got a message
saying this was not possible with a continuous form. The reason i want
the 1st subform as a continuous form is because i want the user to be
able to select more than one team member at a time and add an absence or
shift change - rather than having to do this one team member at a time.

Hope this makes sense and would be grateful for any help.

thanks
michelle

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #2

P: n/a

Hi Andrew
Thanks for your help.

However, i can't seem to get the 2 subforms to synchronise. Do you
think that this is because the first subform is a continuous form.

regards
michelle
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3

P: n/a
No, because it works for me. But, you will need to requery the second
subform in the Activate event of the main form, and in the OnCurrent event
of the Form embedded in the first Subform control.

In the main form's Activate event, mine is:

Me.sbfWorkerAbsences.Requery

In the first subform's OnCurrent, mine is:

Me.Parent!sbfWorkerAbsences.Requery

It doesn't synchronize automatically with a change in the first subform; the
automatic synchronization is limited to a change in the parent of a given
subform, but you can force it to use something else -- as was suggested
here.

Larry Linson
Microsoft Access MVP

"Michelle" <mi*************@poferries.com_NOSPAM> wrote in message
news:40*********************@news.frii.net...

Hi Andrew
Thanks for your help.

However, i can't seem to get the 2 subforms to synchronise. Do you
think that this is because the first subform is a continuous form.

regards
michelle
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #4

P: n/a
Thanks for catching that, Larry!

All the best,
Andrew

"Larry Linson" <bo*****@localhost.not> wrote in message
news:nY******************@nwrddc03.gnilink.net...
No, because it works for me. But, you will need to requery the second
subform in the Activate event of the main form, and in the OnCurrent event
of the Form embedded in the first Subform control.

In the main form's Activate event, mine is:

Me.sbfWorkerAbsences.Requery

In the first subform's OnCurrent, mine is:

Me.Parent!sbfWorkerAbsences.Requery

It doesn't synchronize automatically with a change in the first subform; the automatic synchronization is limited to a change in the parent of a given
subform, but you can force it to use something else -- as was suggested
here.

Larry Linson
Microsoft Access MVP

"Michelle" <mi*************@poferries.com_NOSPAM> wrote in message
news:40*********************@news.frii.net...

Hi Andrew
Thanks for your help.

However, i can't seem to get the 2 subforms to synchronise. Do you
think that this is because the first subform is a continuous form.

regards
michelle
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 12 '05 #5

P: n/a
Michelle <mi*************@poferries.com_NOSPAM> wrote in
news:40*********************@news.frii.net:

Hi Andrew
Thanks for your help.

However, i can't seem to get the 2 subforms to synchronise.
Do you think that this is because the first subform is a
continuous form.

regards
michelle


The way I set up synchronization of two subforms is to create a
hidden textbox on the parent form. In the Current Event of the
subform, put the subform key into this hidden textbox.
For the second subform, set it's parent link field to the hidden
textbox. Access handles the requery for you. Unfortunately, you
won't be able to update a sickday for two team members at the same
time, but you can do the one after the other.

Bob Q
Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.