Hi. I hope somebody can point me in the right direction with help on how to use cascading combo boxes on MS Access forms.
I have 4 tables;
tblManufacturer;
ManufacturerID (PK)
Manufacturer
tbl Model;
ModelID (PK)
Model
tblMachineParts;
PartID (PK)
ManufacturerID (FK)
ModelID (FK)
PartNumber(FK)
tblParts;
PartDescription
PartNumber (PK)
Supplier
The same part can be used by multiple manufacturers and thats why I have tblMachineparts.
What i'm trying to do is have a form with cascading combo boxes so that the user can select a manufacturer and model and then a list of available parts is shown on a subform.
I have 2 unbound combo boxes
cboManufacturer and cboModel
For the rowsource for cboManufacturer I have:
SELECT tblManufacturer.ManufacturerID, tblManufacturer.EquipmentManufacturer FROM tblManufacturer
The rowsource for cboModel is based on the afterupdate event on cbomanufacturer:
Private Sub
cboManufacturer_AfterUpdate()
Me.cboModel.RowSource = "Select[ModelID]FROM tblMachineParts WHERE [ManufacturerID]=""&cboManufacturer&"""
Me.cboModel.Requery
End Sub
cboManufacturer works no problem and brings up all the manufacturers but when I click on cboModel I get "Data type mismatch in criteria expression" error.
I'm grateful for any advice given.
Alan
I have 4 tables;
tblManufacturer;
ManufacturerID (PK)
Manufacturer
tbl Model;
ModelID (PK)
Model
tblMachineParts;
PartID (PK)
ManufacturerID (FK)
ModelID (FK)
PartNumber(FK)
tblParts;
PartDescription
PartNumber (PK)
Supplier
The same part can be used by multiple manufacturers and thats why I have tblMachineparts.
What i'm trying to do is have a form with cascading combo boxes so that the user can select a manufacturer and model and then a list of available parts is shown on a subform.
I have 2 unbound combo boxes
cboManufacturer and cboModel
For the rowsource for cboManufacturer I have:
SELECT tblManufacturer.ManufacturerID, tblManufacturer.EquipmentManufacturer FROM tblManufacturer
The rowsource for cboModel is based on the afterupdate event on cbomanufacturer:
Private Sub
cboManufacturer_AfterUpdate()
Me.cboModel.RowSource = "Select[ModelID]FROM tblMachineParts WHERE [ManufacturerID]=""&cboManufacturer&"""
Me.cboModel.Requery
End Sub
cboManufacturer works no problem and brings up all the manufacturers but when I click on cboModel I get "Data type mismatch in criteria expression" error.
I'm grateful for any advice given.
Alan