Dependant combo box in subform

L

LaurenM

Hi everyone,

I am using Access 2003 on a Windows XP machine. I am having a little touble
making my dependant combo box work in a subform I have created. If anyone can
help unravel this mystery, I would greatly appreciate it.

I have a main form (AddContacts) and a subform (MediaType). In my subform I
have two combo boxes: One is "MediaType" and the other is "SubMediaType" .
When I select a MediaType, I want the related SubMediaTypes only to show up
in the SubMediaType combo box. This works brilliantly in my subform on its
own. However, when I embed it it my main form (AddContacts), I get a message
indicating that I need to need to enter a parameter value as if I did not
choose a Media Type first (which I can do with no issue in the embedded
subform). In my criteria in the subMediaType row source is
[Forms]![MediaType]![cbo_MediaType]. I am a novice to writing SQL statements
so I am using the query builder. It seems like I need to indicate the main
form in this somehow or I need to maybe do something in the main form? Not
sure. Again any helpful info anyone has would be terrific.

Thanks in advance!
 
B

bhicks11 via AccessMonster.com

Try me.[cbo_MediaType] or forms!MAINFORMNAME.[MediaType]!form.[cbo_MediaType]

Bonnie
http://www.dataplus-svc.com
Hi everyone,

I am using Access 2003 on a Windows XP machine. I am having a little touble
making my dependant combo box work in a subform I have created. If anyone can
help unravel this mystery, I would greatly appreciate it.

I have a main form (AddContacts) and a subform (MediaType). In my subform I
have two combo boxes: One is "MediaType" and the other is "SubMediaType" .
When I select a MediaType, I want the related SubMediaTypes only to show up
in the SubMediaType combo box. This works brilliantly in my subform on its
own. However, when I embed it it my main form (AddContacts), I get a message
indicating that I need to need to enter a parameter value as if I did not
choose a Media Type first (which I can do with no issue in the embedded
subform). In my criteria in the subMediaType row source is
[Forms]![MediaType]![cbo_MediaType]. I am a novice to writing SQL statements
so I am using the query builder. It seems like I need to indicate the main
form in this somehow or I need to maybe do something in the main form? Not
sure. Again any helpful info anyone has would be terrific.

Thanks in advance!
 
L

LaurenM

Thank you, Bonnie for you response. When I make your suggested changes in the
subform (replacing my original criteria with the criteria you suggested
below), I am still prompted to enter a parameter value for the SubMediaType
to show up while embedded in the main form. It does show up but I need to
type in the value that I chose in the Media Type combo box. Do I need to
change the VBA code that I have in the On Change Event tab on my
cbo_MediaType field in my subform? Now I have it as follows:

Private Sub cbo_MediaType_Change()
Me.cbo_MediaSubType.Value = ""
Me.cbo_MediaSubType.Requery

End Sub

Again, thank you for your time!

bhicks11 via AccessMonster.com said:
Try me.[cbo_MediaType] or forms!MAINFORMNAME.[MediaType]!form.[cbo_MediaType]

Bonnie
http://www.dataplus-svc.com
Hi everyone,

I am using Access 2003 on a Windows XP machine. I am having a little touble
making my dependant combo box work in a subform I have created. If anyone can
help unravel this mystery, I would greatly appreciate it.

I have a main form (AddContacts) and a subform (MediaType). In my subform I
have two combo boxes: One is "MediaType" and the other is "SubMediaType" .
When I select a MediaType, I want the related SubMediaTypes only to show up
in the SubMediaType combo box. This works brilliantly in my subform on its
own. However, when I embed it it my main form (AddContacts), I get a message
indicating that I need to need to enter a parameter value as if I did not
choose a Media Type first (which I can do with no issue in the embedded
subform). In my criteria in the subMediaType row source is
[Forms]![MediaType]![cbo_MediaType]. I am a novice to writing SQL statements
so I am using the query builder. It seems like I need to indicate the main
form in this somehow or I need to maybe do something in the main form? Not
sure. Again any helpful info anyone has would be terrific.

Thanks in advance!
 
B

bhicks11 via AccessMonster.com

Try:


Me.Requery



Thank you, Bonnie for you response. When I make your suggested changes in the
subform (replacing my original criteria with the criteria you suggested
below), I am still prompted to enter a parameter value for the SubMediaType
to show up while embedded in the main form. It does show up but I need to
type in the value that I chose in the Media Type combo box. Do I need to
change the VBA code that I have in the On Change Event tab on my
cbo_MediaType field in my subform? Now I have it as follows:

Private Sub cbo_MediaType_Change()
Me.cbo_MediaSubType.Value = ""
Me.cbo_MediaSubType.Requery

End Sub

Again, thank you for your time!
Try me.[cbo_MediaType] or forms!MAINFORMNAME.[MediaType]!form.[cbo_MediaType]
[quoted text clipped - 21 lines]
 
L

LaurenM

Hi Bonnie,

I figured it out. I had to change my VBA code to read the name of the
subform instead of "Me." I changed it to read:

Private Sub cbo_MediaType_Change()
Thanks so much for your ideas!

bhicks11 via AccessMonster.com said:
Try:


Me.Requery



Thank you, Bonnie for you response. When I make your suggested changes in the
subform (replacing my original criteria with the criteria you suggested
below), I am still prompted to enter a parameter value for the SubMediaType
to show up while embedded in the main form. It does show up but I need to
type in the value that I chose in the Media Type combo box. Do I need to
change the VBA code that I have in the On Change Event tab on my
cbo_MediaType field in my subform? Now I have it as follows:

Private Sub cbo_MediaType_Change()
Me.cbo_MediaSubType.Value = ""
Me.cbo_MediaSubType.Requery

End Sub

Again, thank you for your time!
Try me.[cbo_MediaType] or forms!MAINFORMNAME.[MediaType]!form.[cbo_MediaType]
[quoted text clipped - 21 lines]
Thanks in advance!

--



.
 
B

bhicks11 via AccessMonster.com

I always have to play with it a bit when it's subform references.
Hi Bonnie,

I figured it out. I had to change my VBA code to read the name of the
subform instead of "Me." I changed it to read:

Private Sub cbo_MediaType_Change()
Thanks so much for your ideas!
[quoted text clipped - 21 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top