Feb 04 2020 08:23 AM
Feb 04 2020 08:48 AM
@Asad_khan1971 This is a very common function. We usually refer to it as "Cascading Combo Boxes".
A search on that term will turn up a plethora of explanations and examples.
Feb 04 2020 10:09 AM
Feb 05 2020 06:31 AM
"... combo box which lists the fields from a table ..."
"My other combo box contains the values of fields which are listed in the combo box one"
That's a first for me. I never heard of that approach before, so I'm curious as to why you do this.
I suspect what you have is a table with fields like "Data1", "Data2", where you're encoding values into the names of the fields? Is that the case?
If so, that's the real problem and this rather unconventional approach to cascading combo boxes (and that is, indeed, the same principle) is a result of that table design.
So, what ARE some examples of the real field names in this table? And what are some examples of the values in those fields you want for the second combo box?
Feb 05 2020 08:05 AM
Feb 05 2020 08:07 AM
Feb 05 2020 08:15 AM
Solution@Asad_khan1971 As I feared, it sounds like you have a "spreadsheet style" table. That is fine for Excel, but not for a Relational Database Application, such as those built in Access.
The solution -- the one that will pay off most in the long run -- is to correct this flawed table design, as described in this series of blog posts.
Fields in this table should actually be records in a single field, or a few fields, depending on what is in each of them. Following the correction to the underlying table, this particular problem with combo boxes will simply not exist.
Feb 05 2020 02:07 PM - edited Feb 05 2020 02:08 PM
Feb 06 2020 06:20 AM
I think I understand pretty well. Over the last 25 years of working with Access Relational Database Applications, I've seen this mistaken approach to table design many, many times. Excel tables have multiple columns, each of which is one kind of thing. You only offered one column name, but that's enough to give us the picture. That one is a yes/no question, is it not? And you have many other fields like it, all of them being yes/no questions, do you not? That is the problem. It is the reason you are trying to create this cascading combo box set up to compensate for that design problem.
I could offer a work-around that would look up the field in that table and use that to populate the second combo box with values, but that would be a work-around, not a solution.
Please invest some time in learning more about Relational Database Design. Your survey will be significantly better.
Here is a link to one of the more popular survey templates. It's been downloaded thousands of times. It'll be useful to you as well, I believe.
Feb 05 2020 08:15 AM
Solution@Asad_khan1971 As I feared, it sounds like you have a "spreadsheet style" table. That is fine for Excel, but not for a Relational Database Application, such as those built in Access.
The solution -- the one that will pay off most in the long run -- is to correct this flawed table design, as described in this series of blog posts.
Fields in this table should actually be records in a single field, or a few fields, depending on what is in each of them. Following the correction to the underlying table, this particular problem with combo boxes will simply not exist.