Cascading DropDowns With Subform

dgreatjc

Registered User.
Local time
Today, 13:58
Joined
Oct 22, 2008
Messages
10
I've spent so much time on this, and now I am almost there. Any help would be much appreicated.

I have a form in which I select a category of work from ComboBox "WorkTypeMain". Now I want to filter out all types of work under this category from table "z_ProposalDetailList". In this table, column "Details" has the details I want to filter and pick in ComboBox2. Column "WorkType" from this table is a Number which is a lookup to another table that lists the category of work. This table is what I select from the first ComboBox.

Anyways, everything is working great when I go to "Test1" ComboBox from the main form. However, I want this to work in the subform. When I select the Drop Down in the Subform, it asks me to "Enter Parameter" of what "WorkTypeMain" is. Once I type the number that matches the ID Key of the table, it then lists the right information. I'm sure it is something very stupd and simple with the last line of code. Please help.

Main Form name is "Proposals"
Subform Name is "z_ProposalDetailsSubform"
DropDown Box in subform label is "ProposalDetails"


Dim strSQL As String
strSQL = "SELECT [Details] " _
& "FROM [z_ProposalDetailList] " _
& "WHERE WorkType =WorkTypeMain"
Me.Test1.RowSource = strSQL
Me.z_ProposalDetailsSubform!ProposalDetails.RowSource = strSQL
 
You must include the Form property when refering to objects on a subform.

Code:
Me.z_ProposalDetailsSubform[B].Form[/B]!ProposalDetails.RowSource

On a main form Form is the default property so it can be omitted.
But the subform object is inside a subformcontrol.
The default property of a control is Value.

So even though a subformcontrol doen't have a Value property, to keep to standards for controls the Form property must be specified.
 
Thank you for the suggestion. I've tried it and it still doesn't work. I'm probably doing something very stupid. I've attached a stripped down copy of the database if anyone could help.

On the form Proposals, I want to select a category such as "Painting" from the Box with the Green Label. Next, I want to select from the Box with the Red Label a category of painting. This works great. But in the subform right below, I wish to do the same, but when I click on it, it asks me for parameter "WorkTypeMain". Once I type "2" which is the Painting category, it works fine, although it wants to store text instead of the Integer of lookup value which I have to work on next.

Any help would be much appreciated. Thank you.
 

Attachments

Rename all fields currently called Detail. It already has a meaning in the form object and is hence a reserved word. Even enclosing in brackets will not fix this because [Detail] is an object.
 

Users who are viewing this thread

Back
Top Bottom