Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    captiangvp is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2021
    Posts
    24

    3rd Cascading Combo Boxes

    Ok, so I have made a cascading combo box, where the Manufacturers field populates, then the 2nd box populates the Products that only relate to the Manufacturer selected in the first box. BUT for some reason, the 3rd combo box comes up blank.

    So it goes as this
    Manufacturer
    Manufacturer>Products
    Manufacturer>Products>Featurename

    I'm doing the 3rd exactly as i did the 2nd but its coming up blank for some reason.


    I'm using a criteria in the query builder that goes like this in the second combo box:
    [FORMS]![Options_Form]![Manu]
    I do the same in the 3rd combo box but as such:
    [Forms]![Options_Form]![productid]

    but the 3rd one isnt populating anything correct.... but if i leave out the criteria, it displays stuff in that 3rd box, but its not based on whats chosen in the 2nd combo box and just displays every bit of the featurenames

    I would attach a copy of it but it says no bigger than 500kb and using the compact button only gets it down to 600 haha, so if thers another way for me to get ya'll a copy to try, pls let me know! Thanks for all the help ahead of time!

    Edit: Attached a zip
    Attached Files Attached Files
    Last edited by captiangvp; 09-29-2021 at 07:20 PM. Reason: Attached a zip

  2. #2
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Maybe an example of cascading combo boxes will help.... I created this ages ago -
    Attached Files Attached Files

  3. #3
    captiangvp is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2021
    Posts
    24
    Quote Originally Posted by ssanfu View Post
    Maybe an example of cascading combo boxes will help.... I created this ages ago -
    I'm an idiot and forgot about creating zip files lmao
    Anyways.. yes thats what i want to do but for some reason its not working on this file... the 3rd box just displaying nothing
    Attached Files Attached Files

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,407
    TACS_ProductsEntry_davegri-v01.zip

    Have a look at this revision

  5. #5
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    You have made 2 errors - one of them very serious.
    First and easy is to study how combo box bound fields work. Here's a quick primer: your combo rowsource is the query or table that builds the list. The order of list columns is the same as the field order in the sql statement. If there is more than one column and you choose column 1 as the bound column, that is the column that will be used in any subsequent references (i.e values from that column become the combo.Value property).

    In your case 2nd combo value becomes OptionID because it's the first in the sql statement and the bound column is 1 - and that table field has no values in the records.

    Second but much worse is that you have designed this table like a spreadsheet and that's quite bad. If you don't fix it now, you will forever struggle and some things will be downright impossible to solve. Access is a relational database whose data is broken out into related tables and those tables are joined by queries by "linking" related fields. That makes db data "tall" whereas Excel is very wide and it's OK to repeat data in many sheet rows. With Access, it is not OK.

    Access has a steep learning curve but the road is ever more arduous if you don't avoid common pitfalls. Start with normalization and you should see just how far off you are at the moment.

    Normalization Parts I, II, III, IV, and V
    http://rogersaccessblog.blogspot.com...on-part-i.html
    and/or
    http://holowczak.com/database-normalization/

    Entity-Relationship Diagramming: Part I, II, III and IV
    http://rogersaccessblog.blogspot.com...ng-part-i.html

    How do I Create an Application in Microsoft Access?
    http://rogersaccessblog.blogspot.com...cation-in.html

    If you want more links on how to properly name Access objects, etc. etc. I have more links to keep you up at night.
    Last edited by Micron; 09-29-2021 at 09:14 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    Join Date
    Apr 2017
    Posts
    1,679
    In addition to Micron's post, after you design your database as normalized, you can avoid the need for cascaded combos at all! An example explained:

    You have a table e.g. tblManufacturers: ManufacturerID, ManufacturerName, ...;
    You have a table e.g. tblProducts: ProductID, ProductName, [ManufacturerID], ...; (You have ManufacturerID in this table, when all products are produced ONLY by single manufacturer!)
    In case at least some products may be produced by different manufacturers, you need a table e.g. tblManufacturerProducts: ManufacturerProductID, ManufacturerID, ProductID;
    You have a table e.g. Features: FeatureID, FeatureName, ...
    You have a table e.g. ProductFeatures: ProductFeatureID, ProductID, FeatureID, FeatureValue;
    You create a single form fManufacturers, with manufacturers table ) as source;
    You create a continuous form fManufacturerProducts with either tblProducts or a joined query from tblManufacturerProducts and tblProducts as source;
    You add the form fManufacturerProducts into Detail section of fManufacturers as a subform (sfManufacturerProducts). The subform must be joined to parent form through ManufacturerID - this ensures the subform always displays all and only products registered for active manufacturer, and any new products added into subform, are automatically registered for active manufacturer;
    Into fManufacturers you add an hidden unbound text box. For fManufacturerProducts firm, you write a Current event, which writes current ProductID of subform into this hidden text box;
    You create a continuous form e.g. fManufacturerProductFeatures with tblProtuctFeatures as source;
    You add the form fManufacturerProductFeatures as subform into Detail section of fManufacturers (sfManufacturerProductFeatures). This subform must be joined with hidden text box on fManufacturers (txtActiveProductID to ProductID). When done correctly, all features of current product in subform sfManufacturerProduct are displayed in sfManufacturerProductFeatures.

  7. #7
    captiangvp is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2021
    Posts
    24
    Quote Originally Posted by davegri View Post
    TACS_ProductsEntry_davegri-v01.zip

    Have a look at this revision
    Hey, just seen these replies, thanks for your try but i'm trying to get the 3rd combo box to display items based on what the 2nd combo box shows. The way you have provided just shows any based on the first combo box

  8. #8
    captiangvp is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2021
    Posts
    24
    Quote Originally Posted by Micron View Post
    You have made 2 errors - one of them very serious.
    First and easy is to study how combo box bound fields work. Here's a quick primer: your combo rowsource is the query or table that builds the list. The order of list columns is the same as the field order in the sql statement. If there is more than one column and you choose column 1 as the bound column, that is the column that will be used in any subsequent references (i.e values from that column become the combo.Value property).

    In your case 2nd combo value becomes OptionID because it's the first in the sql statement and the bound column is 1 - and that table field has no values in the records.

    Second but much worse is that you have designed this table like a spreadsheet and that's quite bad. If you don't fix it now, you will forever struggle and some things will be downright impossible to solve. Access is a relational database whose data is broken out into related tables and those tables are joined by queries by "linking" related fields. That makes db data "tall" whereas Excel is very wide and it's OK to repeat data in many sheet rows. With Access, it is not OK.

    Access has a steep learning curve but the road is ever more arduous if you don't avoid common pitfalls. Start with normalization and you should see just how far off you are at the moment.

    Normalization Parts I, II, III, IV, and V
    http://rogersaccessblog.blogspot.com...on-part-i.html
    and/or
    http://holowczak.com/database-normalization/

    Entity-Relationship Diagramming: Part I, II, III and IV
    http://rogersaccessblog.blogspot.com...ng-part-i.html

    How do I Create an Application in Microsoft Access?
    http://rogersaccessblog.blogspot.com...cation-in.html

    If you want more links on how to properly name Access objects, etc. etc. I have more links to keep you up at night.
    While i appreciate the input and help that has been attempted on my project.. this specific project has to be done this way due to where the data is going.. its part of a much bigger access file but i've only provided the table and form that i'm having issues with.

    Everything i found online before posting here, shows cascading combo boxes as i am doing it. One person even step by step does the 3rd combo box just like i am. I am getting confused though as to why it displays as nothing, with just a blank field.
    I believe that tutorial was one with country, region/county, city. He was able to get the 3rd combo box to display items based on what the 2nd one shows, by doing it exactly like me but for some reason it isnt working for me.. and thats all i need to work for this project left. It completely baffles and aggravates me to follow someone step by step and get a different response lol

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Since the responses and samples given so far do not do exactly what you want/need, how about showing us an example or 2 showing each combo in the cascade and the values you expect/need? Mock something up if necessary.

  10. #10
    captiangvp is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2021
    Posts
    24
    Sample DB.zip
    Quote Originally Posted by orange View Post
    Since the responses and samples given so far do not do exactly what you want/need, how about showing us an example or 2 showing each combo in the cascade and the values you expect/need? Mock something up if necessary.
    I thought I had as i shown this:
    "Manufacturer
    Manufacturer>Products
    Manufacturer>Products>Featurename"
    But now i see that i didnt 100% specify so i apologize.
    What happens is you choose the manufacturer in the first box. Then the second box you are choosing the product.
    Right now, this far it works. the 2nd box ONLY displays what products pertain to the manufacturer chosen in the 1st box.
    What's broken, despite following examples and tutorials 100% is the 3rd box. Should display features that pertain to the product that is chosen in the 2nd box. Instead its coming up blank.... See attached image of it being blank.
    also attached again is the database. Mind you it is cut down to just one table and one form as thats the only form i'm having issues with at the moment.Click image for larger version. 

Name:	Screenshot_1.png 
Views:	22 
Size:	12.6 KB 
ID:	46339

  11. #11
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    So create a DB with just what is needed to see the issue.
    Describe exactly what needs what. Upload it and hope someone fixes it for you.
    I am assuming that data is there to be seen? Have you created a query to see what is produced?

    Replace any sensitive data.

    One query, you are not using lookup fields in the table are you?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  12. #12
    captiangvp is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2021
    Posts
    24
    Quote Originally Posted by Welshgasman View Post
    So create a DB with just what is needed to see the issue.
    Describe exactly what needs what. Upload it and hope someone fixes it for you.
    I am assuming that data is there to be seen? Have you created a query to see what is produced?

    Replace any sensitive data.

    One query, you are not using lookup fields in the table are you?
    I...... have done exactly this.. lol the attached data base in previous comments is narrowed down to just the problem form and table, and the last comment i made has the screenshot of the 3 fields, 3rd being messed up WITH the database attached to that comment as well. idk how much more i can narrow it down to get help for it

  13. #13
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    I am getting confused though as to why it displays as nothing, with just a blank field.
    I believe I answered that.
    I'll put it another way. In the immediate window I can check what value a form control contains.
    ?Forms!Options_Form!productid
    3 < the result is 3 while the combo shows ConnieTest

    Similar for Manufacturer
    ?Forms!Options_Form!Manu
    American Products Group (APG)

    Your sql then becomes SELECT Options.featurename FROM Options WHERE
    (((Options.productid)=3) And ((Options.manu)=American Products Group (APG)));

    Are any of your Options.ProductID records equal to 3?

    So you think you've done it exactly as elsewhere yet it doesn't work for you. Shouldn't that tell you that you're missing something? Hopefully now you can see where you're going wrong - at least with this part. Too bad I wasn't able to convince you about the design flaws. I never understand it when a novice says it has to be that way when they don't know what they don't know. Wish you luck with that though.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  14. #14
    captiangvp is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2021
    Posts
    24
    Quote Originally Posted by Micron View Post
    I believe I answered that.
    I'll put it another way. In the immediate window I can check what value a form control contains.
    ?Forms!Options_Form!productid
    3 < the result is 3 while the combo shows ConnieTest

    Similar for Manufacturer
    ?Forms!Options_Form!Manu
    American Products Group (APG)

    Your sql then becomes SELECT Options.featurename FROM Options WHERE
    (((Options.productid)=3) And ((Options.manu)=American Products Group (APG)));

    Are any of your Options.ProductID records equal to 3?

    So you think you've done it exactly as elsewhere yet it doesn't work for you. Shouldn't that tell you that you're missing something? Hopefully now you can see where you're going wrong - at least with this part. Too bad I wasn't able to convince you about the design flaws. I never understand it when a novice says it has to be that way when they don't know what they don't know. Wish you luck with that though.
    Yes, it HAS to be done this way because the client only wants a set amount of tables and forms, we've discussed other things and this is the way they want it so it HAS to be this way
    Yes, i have done it EXACTLY as this video: https://www.youtube.com/watch?v=at0uaGSnUco&t=401s
    Except he uses Me! instead of requery (which i've tried that too just incase something weird going on and it didnt change anything), his 3rd combo box works perfectly without many tables, just working off of one; and he only has 4 columns of data where as we have much more.

    I've actually gotten it to now display correctly as of 2 minutes ago. But now its running into an error when trying to auto fill the information of the rest of the sheet, so i'm going to try to recreate it from scratch and see what happens
    (when choosing these 3 things, it should auto fill the rest of the form with information already in the table, but its running into an error:

    Click image for larger version. 

Name:	Screenshot_2.png 
Views:	22 
Size:	51.2 KB 
ID:	46341
    Click image for larger version. 

Name:	Screenshot_3.png 
Views:	22 
Size:	57.6 KB 
ID:	46342)

    Yet another feature that works flawlessly when its just 2 combo boxes, 3rd seems to just throw everything haywire

  15. #15
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    You need to be consistent.
    You have combos with a PK and description, others with just a description? Then you are trying to find the PK in a description only combo?
    I doubt the DB is normalised, but if it is not yours, that is what you are stuck with? However I would suspect more than one manufacturer can make a Connie Test?
    As for your type mismatch, I would expect anything with ID to be numeric? (but that is just me, being consistent), so get rid of the str()? No idea why you would want to use it anyway?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Cascading Combo Boxes
    By raychow22 in forum Forms
    Replies: 15
    Last Post: 06-09-2017, 10:39 AM
  2. Cascading Combo Boxes
    By JCW in forum Programming
    Replies: 4
    Last Post: 04-02-2014, 05:05 PM
  3. Sum of Cascading Combo Boxes
    By alonewolf23 in forum Forms
    Replies: 2
    Last Post: 11-20-2011, 02:10 PM
  4. Cascading combo boxes
    By combine21 in forum Forms
    Replies: 3
    Last Post: 12-02-2010, 12:57 PM
  5. Cascading Combo Boxes
    By desireemm1 in forum Programming
    Replies: 1
    Last Post: 10-05-2009, 06:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums