Question 3: How do you use one combo box to affect the contents of another combo box

not a code fan

Registered User.
Local time
Today, 14:33
Joined
Nov 21, 2004
Messages
32
Again a question that i have seen asked before and again the answer contained lots of jargon i didn't understand.

I have 3 combo boxes in the address section of my form; suburb, town and country. I want to use the combo boxes to limit each other as entries are made into the boxes.

When i have found answers as to how to solve this problem I seem to be getting stuck in the code needed for the after event row source thingy.

Can anyone explain how to solve this problem in a simple way with little access jargon?
 
There are examples in the sample database forum

Col
 
If I remember rightly then there is only three lines of code in my example here - two of which are aesthetic, the remainder being the only necessary line for a cascade.
 
Thanks for the info but feeling rather lost

Thanks for the helps although I am beginning to think maybe i picked the wrong forum as everyone is speaking another language to me. It's hard to tell what skill level i am at with my database (i thought i had learnt a lot) but it doesn't look like i understand a lot of what people are talking about with regard to coding and such. I'm very close with the combo box thing but there is something small getting in my way. So far by part fluke i have managed to get one combo box to find a record in another but i can't get the second combo box to bring up more than on entry in the list. It's hard to explain what i have done, i'm not even sure myself.

It'll click at some point or are there any other non jargon speaking Access beginners out there who understand what i am on about?
 
Let's start with your tables.

What tables do you have? What fields are in them? Which fields are related? Which table will be the parent in this cascade and which will be the child?
 
Check out the filteredcomboboxes.zip sample I posted @ dynamic comboboxes

You are probably missing the requery command in the AfterUpdate event of your combo boxes.

Code:
Private Sub cbState_AfterUpdate()
    DoCmd.Requery "cbCity"
End Sub
 
Last edited:
This is what i have

So far i have tried to replicate examples of solutions to this problem. I have copied the structure people have used and then tried to use the row source as has been outlined but with my table/field names. I understand the pieces of the puzzle but don't know how the pieces go together.

I think i am tripping up on a few things. I could have mistyped the code (although i have been careful with this) or more likely when i created the combo boxes i used the wizard incorrectly and ended up sending the information to the wrong place or pulling it from the wrong place. That is an area i get stuck with actually. I can copy the table structure ok and i can look at exmples or row sources but i don't quite know how i am supposed to go about creating the combo box so everything fits. I have used combo boxes before so it's not that i don't know what it is or what it does though. I think i am so very close to getting this.

In my database i have the following combo boxes in this order.. 1.Suburb 2. Village/Town/City 3.County and 4.Country

The underlying 4 separate tables have one field per table so Suburbs for example has one field which is the Suburb field. There are no primary keys or autonumbered fields for these tables and there are no relationships present.
 
The underlying 4 separate tables have one field per table so Suburbs for example has one field which is the Suburb field. There are no primary keys or autonumbered fields for these tables and there are no relationships present.

Then that is exactly why you aren't getting it. You need this:

tblCountries
CountryID - Autonumber
Country - Text

tblCounties
CountyID - Autonumber
County - Text
CountryID - Number (related to tblCountries)

tblTowns
TownID - Autonumber
Town - Text
CountyID - Number (related to tblCounties)

tblSuburbs
SuburbID - Autonumber
Suburb - Text
TownID - Number (related to tblTowns)
 
I have not yet actually tried to use the exact tables and fields (from my database) as described by me in the last post as it would take too long to try and apply those changes to my database.

I have however already tried what you have said with the ID autonumber fields and description fields and foreign keys with small test databases i have made that are replicas of examples i have found on here but still got stuck. If the way you described is the right way then i know how to create the table structure correctly; i reckon i am just tripping up on how i tell the database where to find the information and perhaps where it should be put. Can i create the combo boxes with the wizard or does that screw it up?

Lets imagine i have all the tables set up and all i have to do is create a form and throw in the combo boxes. I just need to know the procedure for putting in the combo boxes and linking them correctly and perhaps altering the row source if needed. Also i will have to know how to find a home for the information selected when i have this sussed. It's not that i don't know how to put information in a table from a combo box it's just it doesn't seem like it is as straightforward with this scenario based on how i have failed so far.

Thanks for your patience on this one although i'm sure there must be some other confused people out there who will benefit from my problem
 
Last edited:

Users who are viewing this thread

Back
Top Bottom