Dependant combo box in subform

  • Thread starter Thread starter LaurenM
  • Start date Start date
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!
 
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!
 
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!

--
Message posted via AccessMonster.com


.
 
Back
Top