Hi Everyone,
Can some one please help me with cascading combo boxes. The structure of my database is below.
tblAsset_Numbers
Asset_NumberId AutoNumber
Asset_Number PK Text
LineID Number (Went through Look up wizard to get data from tblLine)
tblLine
LineID PK AutoNumber
Line Text
Main Table
tbl4MAssets_B&S
AssetID AutoNumber
Asset_Number Text
LineID Number went through look up wizard
Frm4MAssets_B&S
LineID Combo Box
Asset_Number Combo Box
Now I have a form that is bound to tblT4MAssets. What I am trying to do is cascade my Combo boxes on the form, so I can restrict the values of one combo box based on the value in another.
I want a user to select the LineID, then depending on what LineID is chosen the relevant Asset_Number appears in the Asset_Number Combo box.
I have created the relationships but I am still facing a problem. What I don’t see are the foreign keys being created and I don’t think I have structured the sql queries correctly.
Sql Queries,
Where do I place the queries on the table fields or on the form? Currently on tbl4MAssets_B&S on field LineID and Asset_Number I went through the lookup wizard so that I could view the data on the form but I cant seem to get the cascading to work.
I have tried implementing this on the combo box of Asset_Number in the row source:
SELECT tblAsset_Numbers.Asset_Number, tblAsset_Numbers.Asset_NumberID, tblAsset_Numbers.LineID
FROM tblAsset_Numbers
WHERE (((tblAsset_Numbers.LineID) Like [forms]![frm4MAssets_B&S]![cboLineID]));
I should think the Relationships, fine as I have had no errors.
Could any one please help me out on this. I would appreciate any help I get on this.
Thanks.
Can some one please help me with cascading combo boxes. The structure of my database is below.
tblAsset_Numbers
Asset_NumberId AutoNumber
Asset_Number PK Text
LineID Number (Went through Look up wizard to get data from tblLine)
tblLine
LineID PK AutoNumber
Line Text
Main Table
tbl4MAssets_B&S
AssetID AutoNumber
Asset_Number Text
LineID Number went through look up wizard
Frm4MAssets_B&S
LineID Combo Box
Asset_Number Combo Box
Now I have a form that is bound to tblT4MAssets. What I am trying to do is cascade my Combo boxes on the form, so I can restrict the values of one combo box based on the value in another.
I want a user to select the LineID, then depending on what LineID is chosen the relevant Asset_Number appears in the Asset_Number Combo box.
I have created the relationships but I am still facing a problem. What I don’t see are the foreign keys being created and I don’t think I have structured the sql queries correctly.
Sql Queries,
Where do I place the queries on the table fields or on the form? Currently on tbl4MAssets_B&S on field LineID and Asset_Number I went through the lookup wizard so that I could view the data on the form but I cant seem to get the cascading to work.
I have tried implementing this on the combo box of Asset_Number in the row source:
SELECT tblAsset_Numbers.Asset_Number, tblAsset_Numbers.Asset_NumberID, tblAsset_Numbers.LineID
FROM tblAsset_Numbers
WHERE (((tblAsset_Numbers.LineID) Like [forms]![frm4MAssets_B&S]![cboLineID]));
I should think the Relationships, fine as I have had no errors.
Could any one please help me out on this. I would appreciate any help I get on this.
Thanks.