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.
 

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Sanador

Board Regular
Joined
Sep 24, 2004
Messages
108
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,102,274
Messages
5,485,783
Members
407,515
Latest member
franjey

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
  • CELL FORMAT - IF CONDITION
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top