|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Forms - Selective Display of a List of items into A Combo Box
I have a table with multiple columns. Columns 1,3,5, etc are lists of names that I want to be used to display in combo boxes. The rest of the columns are corresponding columns to 1,3,5 which are of type Yes/No selection to determine if I want the name hidden or not.
Is there a way that I can get names from this list to display in a combo box, but make sure the ones that have the Yes/No box checked to be hidden? So far I've been able to list the names in a combo box from a single column, list the names in a combo box from multiple columns, list the names in a combo box from a single column and hiding some of the options by using a query, But when I try to list the names from all columns, it doesn't do what I want. What should I do? I'm kinda new to Access. Thanks. |
|
#2
|
||||
|
||||
|
I can't figure out what you are doing. Instead of describing it in words, please show us exactly what your fields are in the table, like this:
Code:
[tableName]: id Autonumber field1 Text field2 Text ... etc.
__________________
Experience is the thing you have left when everything else is gone. |
|
#3
|
|||
|
|||
|
Okay, so my table design looks like this
Code:
[table1]: name1 Text name1_hide Yes/No [table2]: name2 Text name2_hide Yes/No And my table in datasheet view looks something like this Code:
name1 name1_hide
Red
Blue
Green x
Yellow
name2 name2_hide
House
Apartment
Condo
name2-4 x
Bascially I want to have a combo box that lists: Red,Blue,Yellow, House, Apartment, Condo. (but not Green, and name2-4, because they're selected as hidden) |
|
#4
|
|||
|
|||
|
Is there an easier way to do this than to create separate queries for each name column(e.g. name1, name2, name3, etc) and then combine them into one query to display in the combo box?
|
|
#5
|
||||
|
||||
|
It's not at all clear to me what your table represents. It certainly looks like it is not a valid data structure for a relational database. In relational database design, a table represents an entity, which means a collection of a definable class of people, objects, documents, events, etc. So a table might be described as "students who attend this school" or "invoices for our sales" or "meetings between our clients and our staff"--those kinds of straightforward definitions.
Twenty years of database development has taught me that if I can't specify cleanly exactly WHAT a table represents, I can't use it in a relational database. The occurrence of "repeating groups" like your structure seems to have, is strictly prohibited by the rules of data normalization. If you want to try to explain what you are trying to accomplish in this database, perhaps I can offer some suggestions, but I wouldn't even try to use the structure you showed. Last edited by don94403 : June 30th, 2009 at 09:48 PM. |
|
#6
|
|||
|
|||
|
Thanks for trying to understand the problem I was having. I figured out the real problem is that indeed, like you said, the table makes no sense at all.
I have since changed it so that each set of related columns are now in their own table. Table1 contains name1 and name1_hide Table2 contains name2 and name2_hide Though I've kind of worked around it, I was wondering if it was possible to use all the name1 and name2 values from the fields of both tables(making sure to check that if it's set as hidden in the name1_hide/name2_hide field, that it doesn't show)and put it all in one combo box. I've edited the tables from my second post to show what I want. |
|
#7
|
|||
|
|||
|
Yes it is possible using a UNION query, however you want to be very careful with how you're storing the data you choose. If you are storing the value itself rather than the primary key on your form you will be ok but if you are using the primary key you will probably have to generate the ID yourself rather than relying on autonumber.
For instance if you have these two tables Code:
Color_ID Color_Desc 1 Yellow 2 Blue 3 Green Code:
Shade_ID Shade_Desc 1 Cyan 2 Turquoise 3 Cerulian you can see if you make a union query out of this you're going to have two items that use the same unique identifier and it will make things extremely difficult on you if you are going to then go back and make a query and try to figure out which table the ID you stored is coming from. The syntax for a union query for this example would be:
__________________
---------------- If we've helped you and you have solved your problem please post that it's been resolved so we know! The suspense kills me! |
|
#8
|
|||
|
|||
|
Though it seems you're missing the code you were going to post.
I figured out how to do it using a UNION query. Thank you very much. ![]() |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Forms - Selective Display of a List of items into A Combo Box |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|