Prompt Subform from Combo Box

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

How can I prompt from a main form combo box, a subform
that needs info. filled out? In other words, the
selection on the main form will control and prompt a
subform that requires specific info to be filled out
dependent on the main form combo box selection.

I have 20 selections from the main form combo box of which
each has a corresponding sub form.
 
Try using the ComboBox_AfterUpdate to change the SourceObject to the
appropriate Form to be use as the Subform. Something like:

Me.sfrSubformControl.SourceObject = "frmSuitableForm"
 
Thanks Van but I'm afraid I don't quite understand. The
name of my combo box is
"Item Group Major" with one of the 20 selections
named "Channel Letter".
The name of my sub form is "fChannel Letter".
I'm not sure how to decipher the example below.
My stab(or more like ignorance) at it ...

Item Group Major.sfrSubformControl.SourceObject
= "fChannel Letter"

??? Thanks in advance for any additional help! ???
 
1. You need to check the name of the Subform*Control* in the DesignView of
the Main Form. This can be different from the name of the Subform (more
accurately, the name of the Form being used as the SourceObject). Click the
SubformControl once and check the name in the Properties window.

2. The code should be something like:

Select Case Me.[Item Group Major].Value
Case 1 '{or whatever appropriate}
Me.SuformControl.SourceObject = "fChannel Letter"

Case ...
Me.SuformControl.SourceObject = "..."

Case ...
Me.SuformControl.SourceObject = "..."
End Select
 
Hi Van - still at it! I set up like this...

Select Case Me.[Item Group Major].Value
Case 1 '{or whatever appropriate}
Me.[Item Group Major].Channel Letter = "fChannel Letter Sub"

Case 2
Me..[Item Group Major].Directional = "fDirectional Sub"

Case 3
Me..[Item Group Major].Pylon = "fPylon Sub"
End Select

but the subform doesn't change when I toggle back and
forth on the main form combo box named Item Group Major.
So I looked at the Source Object on the sub form and I'm
not sure how to make it "look" back at the selection. Can
you still help?
-----Original Message-----
1. You need to check the name of the Subform*Control* in the DesignView of
the Main Form. This can be different from the name of the Subform (more
accurately, the name of the Form being used as the SourceObject). Click the
SubformControl once and check the name in the Properties window.

2. The code should be something like:

Select Case Me.[Item Group Major].Value
Case 1 '{or whatever appropriate}
Me.SuformControl.SourceObject = "fChannel Letter"

Case ...
Me.SuformControl.SourceObject = "..."

Case ...
Me.SuformControl.SourceObject = "..."
End Select


--
HTH
Van T. Dinh
MVP (Access)



Thanks Van but I'm afraid I don't quite understand. The
name of my combo box is
"Item Group Major" with one of the 20 selections
named "Channel Letter".
The name of my sub form is "fChannel Letter".
I'm not sure how to decipher the example below.
My stab(or more like ignorance) at it ...

Item Group Major.sfrSubformControl.SourceObject
= "fChannel Letter"

??? Thanks in advance for any additional help! ???


.
 
In my previous post, I wrote that you need:

Me.SuformControl.SourceObject = "fChannel Letter"

You need to replace the SubformControl with the name of the Subform Control.
If I read correctly, [Item Group Major] is the name of the ComboBox (on the
main form) so you definitely used the wrong Control name.

You need to check the name of the SubformControl in the DesignView of the
main Form. Open the main Form in DesignView, select the Subform Control
(think of it as the rectangle surrounding your Subform) and then open the
Properties window. You should see the name of the SubformControl in the
"Other" tab. Use this name in the above statement.

OTOH, I think from what you posted, you probably need some basic
understanding of VBA. If you want to be able to write VBA code and to
improve your skills in Access, I would suggest reading an introductory
Access VBA would be of great benefit to you. One suitable book often
mentioned in these newsgroup is "Beginning Access {YourAccessVersion}VBA" by
Smith & Sussman, published by Wrox.

--
HTH
Van T. Dinh
MVP (Access)



Paul said:
Hi Van - still at it! I set up like this...

Select Case Me.[Item Group Major].Value
Case 1 '{or whatever appropriate}
Me.[Item Group Major].Channel Letter = "fChannel Letter Sub"

Case 2
Me..[Item Group Major].Directional = "fDirectional Sub"

Case 3
Me..[Item Group Major].Pylon = "fPylon Sub"
End Select

but the subform doesn't change when I toggle back and
forth on the main form combo box named Item Group Major.
So I looked at the Source Object on the sub form and I'm
not sure how to make it "look" back at the selection. Can
you still help?
-----Original Message-----
1. You need to check the name of the Subform*Control* in the DesignView of
the Main Form. This can be different from the name of the Subform (more
accurately, the name of the Form being used as the SourceObject). Click the
SubformControl once and check the name in the Properties window.

2. The code should be something like:

Select Case Me.[Item Group Major].Value
Case 1 '{or whatever appropriate}
Me.SuformControl.SourceObject = "fChannel Letter"

Case ...
Me.SuformControl.SourceObject = "..."

Case ...
Me.SuformControl.SourceObject = "..."
End Select


--
HTH
Van T. Dinh
MVP (Access)



Thanks Van but I'm afraid I don't quite understand. The
name of my combo box is
"Item Group Major" with one of the 20 selections
named "Channel Letter".
The name of my sub form is "fChannel Letter".
I'm not sure how to decipher the example below.
My stab(or more like ignorance) at it ...

Item Group Major.sfrSubformControl.SourceObject
= "fChannel Letter"

??? Thanks in advance for any additional help! ???


.
 
Back
Top