Question : Cascading Combo Boxes on a Form (Access 2007)

Hello, old topic for an Access 2007 newbie.
 
I'm trying to build a computer equipment tracking database.  I have tblDevice, tblMake, and tblModel leading into a "master table" called tblComputers  (other data like serial #s, IPs, etc. are stored here).
 
Depending on which device and make is selected (cboDevice and cboMake, respectively), it filters the available choices in the model combo box (cboModel).  
 
I've used the various Microsoft tutorials on the subject, but the VB code just doesn't want to work.  For some reason, the code that should be placing the query code from the AfterUpdate in cboMake into the RowSource for cboModel isn't working--nothing will place into the cboModel RowSource, and I get a blank cboModel combo box, regardless of what I select in cboMake.
 
I'm using unbound combo boxes, I'm copying the code word-for-word, and changing the names to reflect the combo boxes.  I haven't even messed with cboDevice yet as I'm just trying to get make and model to work together first.  
 
Here is the VB code:
 
Private Sub cboMake_AfterUpdate()
Me.cboModel.RowSource = "SELECT Model FROM " & _
                                             "tblModel WHERE MakeID = " & _
                                               Me.cboMake & _
                                             "ORDER BY Model"
Me.cboModel = Me.cboModel.ItemData(0)
End Sub

 
 
Here is my table setup:
 
tblComputers
----------------
PK_Computers_ID
Device Type
Make (FK for tblMake)
Model
Serial Number
 
tblDevice
-----------
PK_Device_ID
Device
 
tblMake
---------
PK_Make_ID
Make
 
tblModel
----------
PK_Model_ID
Model
DeviceID (FK for tblDevice)
MakeID (FK for tblMake)
 
 
I've attached a barebones version of my file with the relevant problem areas.  Any ideas will be greatly appreciated!

Thanks,

Chris
Kandahar, Afghanistan

Answer : Cascading Combo Boxes on a Form (Access 2007)


Well, partially off...
;-)

Cascading Lists depend on a single path for the Hierarchy.
For example: Country-->Sate/Province-->City/Region

Sure you can do this:
Country-->State/Province
Country-->City/Region
...as you ask, but then this says that Sate/Province and City/Region is at the same Hierarchical level, if so then what does State/Province filter?

To make this work in the standard way, (the way it is illustrated in all of the samples), it should be
Grouping1-->(filters)-->Grouping2-->(filters)-->Grouping3


A military example would be
Armed Forces Branch--->Title--->Person

In this case selecting "Marines" from the Armed Forces Branch combobox would filter the Positions combobox for only Marines positions.
Meaning, Seaman Apprentice (Navy) and Captain (Army) will not be available.

Then selecting "Staff Sergeant" from the Position Combobox would filter the Persons combobox to only show Persons who are Staff Sergeants.

Make sense?

;-)

JeffCoachman
Random Solutions  
 
programming4us programming4us