Need help linking subforms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new learner and need help in writing a code for the following

Form "A" has ComboA with "items 1,2,3,4,....)

If Item "1" is selected from ComboA on form A, in detail section of linked
form B a "sub form X" will be opened
If Item "2" is selected from ComboA on form A, a different "sub form Y"
will be opened at detail section of form B. and so fort.....

Any help containing detail and explanation comment is greatly appreciated.

Saied
 
Saied,

I am not sure what you mean by "linked form B" nor what you mean by
opening the subform. Assuming that Form B is a separate form which is
already open when you do the ComboA thing on Form A, and that you have a
subform control on From B which can display either X or Y or whatever,
then try code along these lines, on the After Update event of the ComboA...

Dim SubformName As String
Select Case Me.ComboA
Case 1
SubformName = "sub form X"
Case 2
SubformName = "sub form Y"
Case 3
...etc
End Select
Forms![Form B]![SubformControlName].SourceObject = SubformName
 
Thanks Steve
I have Six different form A,B, C,&....
Each contain command buttons to open different form or reports and linked
text boxes containing same customer demographic data. The subforms will all
require links to the same customer upon changes. One form will be opened at a
time. I'll link all form heading data and subforms in detail section to a
customer ID.

When database is starts a startup form (form1) request for the customer
information. Now I like to add a combo box to form1 requesting link to
different subforms to be loaded in detail se4ction of forms A,B,C,&... base
on selection link in this combobox. Subforms will be different on form A,B,C
& ..., but all will remain linked to the same customer subforms with selected
queries.

Hope this explain my intention better. Your help is greatly appreciated.


Steve Schapel said:
Saied,

I am not sure what you mean by "linked form B" nor what you mean by
opening the subform. Assuming that Form B is a separate form which is
already open when you do the ComboA thing on Form A, and that you have a
subform control on From B which can display either X or Y or whatever,
then try code along these lines, on the After Update event of the ComboA...

Dim SubformName As String
Select Case Me.ComboA
Case 1
SubformName = "sub form X"
Case 2
SubformName = "sub form Y"
Case 3
...etc
End Select
Forms![Form B]![SubformControlName].SourceObject = SubformName

--
Steve Schapel, Microsoft Access MVP

I am new learner and need help in writing a code for the following

Form "A" has ComboA with "items 1,2,3,4,....)

If Item "1" is selected from ComboA on form A, in detail section of linked
form B a "sub form X" will be opened
If Item "2" is selected from ComboA on form A, a different "sub form Y"
will be opened at detail section of form B. and so fort.....

Any help containing detail and explanation comment is greatly appreciated.

Saied
 
Saied,

I think I understand the general idea. Did you try the method I
suggested before?

It is not really a good idea to name forms things like Form1 of Form A
etc. ry to give the forms a meaningful name.

--
Steve Schapel, Microsoft Access MVP

Thanks Steve
I have Six different form A,B, C,&....
Each contain command buttons to open different form or reports and linked
text boxes containing same customer demographic data. The subforms will all
require links to the same customer upon changes. One form will be opened at a
time. I'll link all form heading data and subforms in detail section to a
customer ID.

When database is starts a startup form (form1) request for the customer
information. Now I like to add a combo box to form1 requesting link to
different subforms to be loaded in detail se4ction of forms A,B,C,&... base
on selection link in this combobox. Subforms will be different on form A,B,C
& ..., but all will remain linked to the same customer subforms with selected
queries.

Hope this explain my intention better. Your help is greatly appreciated.


:

Saied,

I am not sure what you mean by "linked form B" nor what you mean by
opening the subform. Assuming that Form B is a separate form which is
already open when you do the ComboA thing on Form A, and that you have a
subform control on From B which can display either X or Y or whatever,
then try code along these lines, on the After Update event of the ComboA...

Dim SubformName As String
Select Case Me.ComboA
Case 1
SubformName = "sub form X"
Case 2
SubformName = "sub form Y"
Case 3
...etc
End Select
Forms![Form B]![SubformControlName].SourceObject = SubformName

--
Steve Schapel, Microsoft Access MVP

I am new learner and need help in writing a code for the following

Form "A" has ComboA with "items 1,2,3,4,....)

If Item "1" is selected from ComboA on form A, in detail section of linked
form B a "sub form X" will be opened
If Item "2" is selected from ComboA on form A, a different "sub form Y"
will be opened at detail section of form B. and so fort.....

Any help containing detail and explanation comment is greatly appreciated.

Saied
 
Thanks Steve

Happy holidays

No I was not able to use the codes.

Any otherway this can be done



Steve Schapel said:
Saied,

I think I understand the general idea. Did you try the method I
suggested before?

It is not really a good idea to name forms things like Form1 of Form A
etc. ry to give the forms a meaningful name.

--
Steve Schapel, Microsoft Access MVP

Thanks Steve
I have Six different form A,B, C,&....
Each contain command buttons to open different form or reports and linked
text boxes containing same customer demographic data. The subforms will all
require links to the same customer upon changes. One form will be opened at a
time. I'll link all form heading data and subforms in detail section to a
customer ID.

When database is starts a startup form (form1) request for the customer
information. Now I like to add a combo box to form1 requesting link to
different subforms to be loaded in detail se4ction of forms A,B,C,&... base
on selection link in this combobox. Subforms will be different on form A,B,C
& ..., but all will remain linked to the same customer subforms with selected
queries.

Hope this explain my intention better. Your help is greatly appreciated.


:

Saied,

I am not sure what you mean by "linked form B" nor what you mean by
opening the subform. Assuming that Form B is a separate form which is
already open when you do the ComboA thing on Form A, and that you have a
subform control on From B which can display either X or Y or whatever,
then try code along these lines, on the After Update event of the ComboA...

Dim SubformName As String
Select Case Me.ComboA
Case 1
SubformName = "sub form X"
Case 2
SubformName = "sub form Y"
Case 3
...etc
End Select
Forms![Form B]![SubformControlName].SourceObject = SubformName

--
Steve Schapel, Microsoft Access MVP


Saied wrote:

I am new learner and need help in writing a code for the following

Form "A" has ComboA with "items 1,2,3,4,....)

If Item "1" is selected from ComboA on form A, in detail section of linked
form B a "sub form X" will be opened
If Item "2" is selected from ComboA on form A, a different "sub form Y"
will be opened at detail section of form B. and so fort.....

Any help containing detail and explanation comment is greatly appreciated.

Saied
 
Back
Top