|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hey all!
I am having issues with my database. I have searched the web hi and lo, but nothing that could help me, or that I could understand. I'm designing a database, in which a few users will have to be able to enter and search for data. I've been doing good so far. have a enterform, searchform, searchbydateform, googlesearchform, navigationform. All the information goes into one table, currenttable. The search forms and entry forms are all run by query, which all works fine. Here is my dilema: The user has to enter a product group. There are about 8 main groups, each of which has about 3-5 sub groups, each sub group has another 2-3 sub groups, and each of these sub groups has 5-6 sub groups. So far i have 4 combo boxes, 'groupmain', 'groupsub', 'groupsub2', 'groupsub3'. I need the combo boxes to update the information, depending on which category was selected in the previous combo box. Example: If I select for 'groupmain' "automation and control systems" then combo box 'groupsub' should only list all systems for automation and control. So far I have everything put into one table. I', not really sure, but i think i need multiple tables with keys? I've found a few examples of this being done with state / city combo boxes, but I can't really relate it to my table. Once I get this done, my database will be complete!!! I hope someone on here can save me from sitting in front of google unsuccesfully for another 3 days.. |
|
#2
|
|||
|
|||
|
This is called cascading combo boxes.
Let's say you have the following 2 tables: Code:
Tbl_Items Item_ID Item_Name 1 Item Part 1 2 Item Part 2 Tbl_Sub_Items Sub_Item_ID Item_ID Sub_Item_Name 1 1 Sub Item 1.1 1 2 Sub Item 1.2 2 1 Sub Item 2.1 2 2 Sub Item 2.2 Now let's say your form is called Frm_Test Your First Combo box is called Fld_Test_Combo1 Your Second Combo box is called Fld_Test_Combo2 Your first combo box should store 2 columns with column 1 being your bound column (Item_ID). Your second combo box would based on a query where the criteria in the ITEM_ID column would be [Forms]![Frm_Test]![Fld_Test_Combo1]. Then in the ON CHANGE or ON EXIT property of the first combo box you'd have the command me.fld_test_combo2.requery
__________________
---------------- 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! |
|
#3
|
|||
|
|||
|
ok cool. I was on the right track then. I had something like that set up before, but deleted it because i thought i was way off. What data type should i set the different fields to? and also, which fields would be the primary key? What i have now is a table with the main_groups and ID fields. There are 69 entry, but only 6 or 7 different Main_groups. Most are in there mutiple times, because there are 10 or so sub groups in each main group. I dont think i'm quite getting this
Is it possible to put a link to my database on here for someone to look at? |
|
#4
|
|||
|
|||
|
A primary key is a field that is not repeated the fields you mentioned don't meet that criteria. The favored way to generate a primary key is to use the autonumber feature. It's quick and painless. If your tables do not use an autonumber feature I'd suggest changing the structure so that it does. It will probably involve making a new table and moving your existing data into the new table. In my example you'd need another field in the Tbl_Sub_Items with an autonumber and name it something like Combination_ID.
You can't post databases here until you reach a certain post count or time on the board but if you upload it to a file sharing website I will take a look. |
|
#5
|
|||
|
|||
|
I tried to follow your sample to the q. but its just not working for me. what columns do i need to include in the query that the second combo box is based on? Do I get to this query by going on row source in the 2nd combo box properties?
I found a bunch of samples online that all follow the format you gave, but somehow, i can't recreate them to work in my database. If you can take a look at this thing, i would be very grateful. whats a website i can share my database with? Quote:
|
|
#6
|
|||
|
|||
|
YEEEHA. never mind bro, i figured it out! So i got it to work for 2 combo boxes. anything special i need to do to make it work on 4, or just same procedure?
|
|
#7
|
|||
|
|||
|
This must be my day! I just got all 4 to work together in harmony.
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Forms - 4 combo boxes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|