C
CDF
Ok so I think I've totally stuffed this up.
As the heading goes I'm trying to fill a combo box with items
depending on what is chosen in another combo box.
I've got a Vehicle Make combo box and a Vehicle Model combo box.
Therefore if someone chooses Honda in the 'make' cbx, then only Honda
models will populate the 'model' cbx.
Simple!!...not for an amateur like me!!
I read this article on mvps.org but I couldn't work it out to fit with
my scenario:
http://www.mvps.org/access/forms/frm0028.htm
It says to set my Make cbx RowSourceType to "Field List" and RowSource
to a table Category, but all I get in the Make cbx list are 2 items:
Make_ID and Make, not the actual list of cars????? But if I set the
rowsourcetype to table/query and the rowsource to an available query
then the 'make' cbx works.
From the example on the mvps site it looked like it was trying to run
an SQL query so I ended up trying to put my own SQL statement in the
afterupdate event of the first cbx and ended up with this:
Private Sub cbx_vehicle_Make_AfterUpdate()
Dim strSQL As String
Dim StrSQLL As String
strSQL = Me!vehicle_Make
StrSQLL = "Select " & tbl_Model.Model & "from " & tbl_Make & "
INNER JOIN " & tbl_Model & " ON " & tbl_Make.Make_ID =
tbl_Model.Make_ID & " where Make = " & strSQL
Me!vehicle_Model.RowSourceType = "Table/Query"
Me!vehicle_Model.RowSource = StrSQLL
End Sub
It doesn't work...what a surprise!! Now before you gurus start
laughing like you've never laughed before, I must point out I'm not a
programmer of VB or SQL but understand both if told the proper code to
use.
Also I've got 4 tables in this database, tbl_Customer, tbl_Vehicle,
tbl_Vehicle_Make, and tbl_Vehicle_Model. Cust and Veh are linked via
Customer_ID. Make and Model are linked via Make_ID, BUT all four are
not linked somehow. Should they be?????? I thought not as the make
and model tables are only used to populate the cbx's on the vehicle
form. Do they still need some sort of link to the other 2 tables????
I'm sure this is a simple question but I just can't get my head around
it.
I've totally confused myself (and probably you by now). If I've left
out any crucial details in order for you to help me, please ask me any
questions you need and I'll answer them asap.
Any help would be appreciated.
As the heading goes I'm trying to fill a combo box with items
depending on what is chosen in another combo box.
I've got a Vehicle Make combo box and a Vehicle Model combo box.
Therefore if someone chooses Honda in the 'make' cbx, then only Honda
models will populate the 'model' cbx.
Simple!!...not for an amateur like me!!
I read this article on mvps.org but I couldn't work it out to fit with
my scenario:
http://www.mvps.org/access/forms/frm0028.htm
It says to set my Make cbx RowSourceType to "Field List" and RowSource
to a table Category, but all I get in the Make cbx list are 2 items:
Make_ID and Make, not the actual list of cars????? But if I set the
rowsourcetype to table/query and the rowsource to an available query
then the 'make' cbx works.
From the example on the mvps site it looked like it was trying to run
an SQL query so I ended up trying to put my own SQL statement in the
afterupdate event of the first cbx and ended up with this:
Private Sub cbx_vehicle_Make_AfterUpdate()
Dim strSQL As String
Dim StrSQLL As String
strSQL = Me!vehicle_Make
StrSQLL = "Select " & tbl_Model.Model & "from " & tbl_Make & "
INNER JOIN " & tbl_Model & " ON " & tbl_Make.Make_ID =
tbl_Model.Make_ID & " where Make = " & strSQL
Me!vehicle_Model.RowSourceType = "Table/Query"
Me!vehicle_Model.RowSource = StrSQLL
End Sub
It doesn't work...what a surprise!! Now before you gurus start
laughing like you've never laughed before, I must point out I'm not a
programmer of VB or SQL but understand both if told the proper code to
use.
Also I've got 4 tables in this database, tbl_Customer, tbl_Vehicle,
tbl_Vehicle_Make, and tbl_Vehicle_Model. Cust and Veh are linked via
Customer_ID. Make and Model are linked via Make_ID, BUT all four are
not linked somehow. Should they be?????? I thought not as the make
and model tables are only used to populate the cbx's on the vehicle
form. Do they still need some sort of link to the other 2 tables????
I'm sure this is a simple question but I just can't get my head around
it.
I've totally confused myself (and probably you by now). If I've left
out any crucial details in order for you to help me, please ask me any
questions you need and I'll answer them asap.
Any help would be appreciated.