Is there an easy way to create synchronised combo boxes?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to create a second combo box where the values change dependent on
the entry in the first combo box. i have tried using the MS Online help
example but the code just isnt working for me on MS Access 2003.

Can anyone offer me a solution? first combo box name: "cbosite" second
"cbospecialty"

Many thanks
 
I am trying to create a second combo box where the values change dependent on
the entry in the first combo box. i have tried using the MS Online help
example but the code just isnt working for me on MS Access 2003.

Can anyone offer me a solution? first combo box name: "cbosite" second
"cbospecialty"

Many thanks

A few actual table and field names and datatypes here would have been
helpful.

If you want to return only the specialty names that do business in a
particular area, leave the cbospecialty Rowsource property blank.

Code the cbosite AfterUpdate event:

Me![cbospecialty].Rowsource = "Select TableName.[Specialty] from
TableName Where TableName.Site = '" & Me![cbosite] & "' Order By
TableName.Specialty;"

The above assumes the bound column of cbosite is Text datatype, not
Number.
 
I have a similar problem, but the code written here doesn't seem to work on
Access 2007. My tables are for Department and Role. they are linked to a
DeptPos table which holds the department and role as one record.

I am trying to fill the cboRole combo with items linked to the chosen
department from cboDepartment. All are set to text.

fredg said:
I am trying to create a second combo box where the values change dependent on
the entry in the first combo box. i have tried using the MS Online help
example but the code just isnt working for me on MS Access 2003.

Can anyone offer me a solution? first combo box name: "cbosite" second
"cbospecialty"

Many thanks

A few actual table and field names and datatypes here would have been
helpful.

If you want to return only the specialty names that do business in a
particular area, leave the cbospecialty Rowsource property blank.

Code the cbosite AfterUpdate event:

Me![cbospecialty].Rowsource = "Select TableName.[Specialty] from
TableName Where TableName.Site = '" & Me![cbosite] & "' Order By
TableName.Specialty;"

The above assumes the bound column of cbosite is Text datatype, not
Number.
 
I have a similar problem, but the code written here doesn't seem to work
on Access 2007. My tables are for Department and Role. they are linked
to a DeptPos table which holds the department and role as one record.

I am trying to fill the cboRole combo with items linked to the chosen
department from cboDepartment. All are set to text.

The ComboBox that should show rows dependent on the value in the first
ComboBox has to be requeried in the AfterUpdate event of the first
ComboBox. Are you doing that?
 
I too am having a great deal of difficulty with this. In my case, I am
trying to add a third combo to a successfully paired two. I'd like a Body
Structures combo to rely upon the value submitted for Body Part, and that to
rely upon the value in Body Area. For example, a choice of "Upper Extremity"
for Body Area could lead to choosing "Shoulder" in the Part combo and then
"Rotator Cuff" as a Structure. Please see my previous post below for further
details:

I used this method successfully in tying together 2 combo boxes, but have
run into a brick wall in attempting to add a third. Summary of data:
Body Areas table (AreaID, AreaName)
Body Parts table (PartID, PartName, AreaID)
Body Structures table (StructureID, StructureName, PartID)
Body Area combo (cboAreas) with AfterUpdate ReQuery
Body Part combo (cboParts) with AfterUpdate ReQuery and tied to Areas Query:

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]));

Body Structure combo (cboStructure1) tied to Parts Query:

SELECT [Body Structures].StructureName
FROM [Body Parts] INNER JOIN [Body Structures] ON [Body Parts].PartID =
[Body Structures].PartID
GROUP BY [Body Structures].StructureName, [Body Parts].PartID
HAVING ((([Body Parts].PartID)=[Forms]![Injuries Form].[cboParts]));

As I said, the first pair of combos is working perfectly. In the third, I
get nothing but a blank drop down list. I've been struggling with this for
some time and can't seem to find any answers. Any help would be appreciated.
 
Back
Top