Cascading combos too complex

Sanador

Board Regular
Joined
Sep 24, 2004
Messages
108
Hello all. I'm trying to create a series of 3 cascading combo boxes using a technique I found on this board. The first combo (cbo.Areas) contains a list of "Body Areas" derived from the table of the same name (with columns: AreaID and AreaName). The second combo (cbo.Parts) lists more specific "Body Parts" using an "Areas Query," the SQL View of which is as follows:

SELECT [Body Parts].PartName
FROM [Body Areas] INNER JOIN [Body Parts] ON [Body Areas].AreaID = [Body Parts].AreaID
WHERE ((([Body Areas].AreaID)=[Forms]![Injuries Form].[cboAreas]));

The Body Parts table consists of columns: PartID, PartName, AreaID. This part works fine! I am able to pull up a body area, such as "Brain," and get a list in the second dropdown box of: "Brain, Skull, Scalp, Face..." etc. Just what I wanted. The problem arises in the 3rd combo box (cbo.Structure1). There is an extensive, even more specific, list of structures within the Body Structures table (formatted the same as the Parts table above) that should show up here but does not. Instead, I get the message:

"This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables."

The "Structures Query" used for cbo.Structure1 was copied from cbo.Parts:

SELECT [Body Structures].StructureName
FROM [Body Parts] INNER JOIN [Body Structures] ON [Body Parts].PartID = [Body Structures].PartID
WHERE ((([Body Parts].PartID)=[Forms]![Injuries Form].[cboParts]))

The Body Structures table currently lists 448 items. Is this simply too much for the query to process? I've read other methods for creating cascading combos but it would appear that they would require me to create tables for each PartID... 35 in all! I am a novice so simple lessons, and any help at all, would be greatly appreciated. Sorry for the lengthy post.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I am at a loss. I've created 3 cascading combo boxes, as poorly described above, using the macro method I found on this site (I've tried copying some VBA without success as well). The first 2 boxes are working perfectly. For example, selecting "Upper Extremity" in the first (cboAreas) updates the second (cboParts) so that it includes items such as "Shoulder", "Elbow", etc... Perfect. This works using a query (AreasQuery)

SELECT [Body Parts].PartName
FROM [Body Areas] INNER JOIN [Body Parts] ON [Body Areas].AreaID = [Body Parts].AreaID
GROUP BY [Body Parts].PartName, [Body Areas].AreaID
HAVING ((([Body Areas].AreaID)=[Forms]![Injuries Form].[cboAreas]));

which is referenced in the field's Row Source. The second combo is set up exactly the same way, but offers nothing but a blank field now. The first and second combos contain an AfterUpdate Requery to the next box. The latter 2 boxes have tables that are set up exactly the same way:

PartID/StructureID - Autonumber
PartName/StructureName - Text
AreaID/PartID - Number (Lookup Row Source: SELECT [Body Areas].AreaID, [Body Areas].AreaName
FROM [Body Areas]
ORDER BY [Body Areas].[AreaName];)

I hope that helps explain the situation a bit better and that somebody out there has some ideas.
 
Upvote 0

Forum statistics

Threads
1,214,946
Messages
6,122,401
Members
449,081
Latest member
JAMES KECULAH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top