Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / May 2008

Tip: Looking for answers? Try searching our database.

Help with Linking Combo boxes in a Subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
samdev - 28 May 2008 05:04 GMT
I have created two combo boxes in a subform....

For example

1. Combo Box State
2. Combo Box City
3. When a state from the Combo Box State is selected, the City combo
box updates to reflect the State chosen by only showing cities in that
selected state.
4. When I open just the subform it works just fine but when I open the
Main form the contains the subform there are issues....
5. I can pick the State just fine but when I go to pick the City - a
box = an "Enter Parameter Value" opens...requesting the value for
[forms]![subform]![cbostate]. The city combo box is now blank.

The row source for the city combo box is a query that contains the
city and the state field - the criteria for the state field [forms]!
[subform]![cbostate].

Not sure why it works, when I do test via the subform but doesn't work
when when I go the main form that includes the subform....

Any ideas would be very appreciated.

Thx!
frogsteaks@yahoo.com - 28 May 2008 19:01 GMT
> I have created two combo boxes in a subform....
>
[quoted text clipped - 21 lines]
>
> Thx!

As usual ther are many ways to skin a cat.  A lot depends on how you
have your data set up.  Please describe how the State and the City
data are maintained.
Steve - 28 May 2008 19:15 GMT
When you open just the subform, the subform is a member of the database
forms collection so your  [forms]![subform]![cbostate] notation correctly
identifies the subform. When you open the main form, the subform is a member
of the main form's controls collection so your [forms]![subform]![cbostate]
notation is not now correct because you are referencing the forms collection
and not the main form's controls collection. The correct notation is
[forms]![nameofsubformcontrolonmainform].form![cbostate]. To get
"nameofsubformcontrolonmainform" , open the main form in design view, select
the box that holds the subform, open Properties, go to the Other tab and
look at the Name property.

Steve

>I have created two combo boxes in a subform....
>
[quoted text clipped - 21 lines]
>
> Thx!
samdev - 28 May 2008 23:35 GMT
> When you open just the subform, the subform is a member of the database
> forms collection so your  [forms]![subform]![cbostate] notation correctly
[quoted text clipped - 36 lines]
>
> - Show quoted text -

Steve:
Thx - I have tried that it still doesn't work and it should from what
you have explained....I even changed the name of the subform in the
mainform and then went and updated the query and I'm still getting the
same parameter value box. I checked to make sure that I was clicking
on the subform box in the mainform by checking the title of the
property box and it reads Subform/subreport so still not sure what is
wrong.

Any other ideas.

Thx!
Steve - 28 May 2008 23:49 GMT
I reread my reply to you and I made an error. Sorry!!

[forms]![nameofsubformcontrolonmainform].form![cbostate]

Should Be:

[forms]!{NameOfMainForm]![nameofsubformcontrolonmainform].form![cbostate]

Also, the white box on your main form is a subform control. The name of that
control is what you want for [nameofsubformcontrolonmainform] NOT the name
of your subform. The name of the subform control may or may not be the same
as the name of the subform.

Steve

On May 28, 2:15 pm, "Steve" <no...@email.com> wrote:
> When you open just the subform, the subform is a member of the database
> forms collection so your [forms]![subform]![cbostate] notation correctly
[quoted text clipped - 44 lines]
>
> - Show quoted text -

Steve:
Thx - I have tried that it still doesn't work and it should from what
you have explained....I even changed the name of the subform in the
mainform and then went and updated the query and I'm still getting the
same parameter value box. I checked to make sure that I was clicking
on the subform box in the mainform by checking the title of the
property box and it reads Subform/subreport so still not sure what is
wrong.

Any other ideas.

Thx!
samdev - 29 May 2008 00:19 GMT
> I reread my reply to you and I made an error. Sorry!!
>
[quoted text clipped - 76 lines]
>
> - Show quoted text -

It worked - THANK YOU! THANK YOU!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.