Full Version: Cascading Combo Boxes On A Continuous Subform
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
KathCobb

I am attempting to learn how to create cascading combo boxes but I need mine to work on a continuous form and in searching around thru tutorials, I see that is not nearly as easy as creating one on a single form.

I need three combo boxes. 1 is the first source--Company name. 2. would be the Plan Types the company offers 3. would then be the different plan name of Those types.

In the examples I have seen for this to work on a continuous form, I need to create a text box to show the value of the combo box and then the combo box shrunk to only show the drop down arrow for that and these are tied together. and then there are after update events for each

Is that really the ONLY way? That seems like a lot of trouble. I was attempting to make my subform before my main form but this has me stopped short.

thanks for any advice or anyone can point me to a tutorial that would be great.

Kathy
theDBguy
Hi Kathy,

Yup, that's pretty much the norm. Take a look at Leigh' website and download the demo called Continuous Form Combo to see other possibilities.

Just my 2 cents... 2cents.gif
KathCobb
Hi DBGuy,

I have two examples of that method--the one you should me and one from another website. Here's the thing....neither of those forms actually work. So not sure those would be the best examples to follow. When I opened the database sample you linked me and tries to enter a new value in the form, the 2nd box of the cascading combo's let you select something but it just disappears after selection. Any idea why that would happen?

How about a book that might walk me through it step by step if I can't find an online source?


THANKS!

Kathy
theDBguy
Hi Kathy,

Cascading comboboxes on continuous form is "tricky." This tutorial that I usually refer people to only talks about a single view form.

Just my 2 cents... 2cents.gif
KathCobb
Thanks DBGuy.

I actually found that tutorial with a google search and was following it make my single form. I'll keep working at it and I'll have to post with specific questions when the time comes that it doesn't work smile.gif

I actually saw that in the book by Doug Steele : Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs. This is one of the tips. But also one of the samples online that didn't seem to work. I am going to go ahead and order the book because it seems to have lots of good tips and good reviews and I am betting the book walks through it step by step.


It seems with access, nothing is ever easy for me. But I'm hanging in there. smile.gif

Kath
theDBguy
Hi Kath,

That's right! Just keep at it. We'll be here if you need us. Good luck!
pere_de_chipstick
Hi Kathy

Attached is an example of the method I've used.

hth
libraccess
Hi
I struggled on this one a couple of months back
Here is another sample attached of another way to go about this. It only has two cbo but you will see it is easy to add a third
Hope you have UtterSuccess
KathCobb
Hi Bernie....It's your friendly pain in the butt.


My subform has the same three boxes name Company, Plan Type & Plan Name. How hard would it be to copy the form into my database--and does the code come along with it? smile.gif I would hate to have to struggle to line up all those boxes when you did such a fantastic job smile.gif


THANKS!!!

The other demo that was posted is super simple but I think it needs a re query in there somewhere because in Bernie's example, once you change the first selection the other boxes go blank and have the new values ready so a value can't be left behind by mistake. Which is perfecto!

KathCobb
Just curiousity about the second demo that only uses combo boxes (not text -combo combined) the code says


Private Sub tblOneFK_AfterUpdate()
Me!tblTwoFK.Requery
End Sub


This approach seems to use the table directly and doesn't utilized Bernies the after update event to first set the next set of box to Null.

Am I reading the code correctly??

Thanks
pere_de_chipstick
Hi Kathy

QUOTE
....It's your friendly pain in the butt.
rollingeyes.gif laugh.gif
Hey, we ALL started somewhere ...

Yes you can import the table into your db (but that's cheating laugh.gif )
You do need to have IDENTICAL Table and field names in your db, otherwise you will need to import the tables from the demo db as well.

Make sure the demo db is closed. Then in the db you want to import it into, go to the ribbon -> Tab: External Data -> Group: Import -> Command: Access

Click 'Browse', select the demo accdb file and click 'Open'
Select 'Import' and Click 'OK'
Select the tables, query and form in the Import Objects box and Click 'OK'
Click 'Close'

hth
KathCobb
Oh --I didn't even think about the queries....You are right, that may be too much cheating, I should probably work my way thru it step by step and learn something smile.gif


I do prefer a good cheat method though. hat_tip.gif



Kathy
KathCobb
And here come the questions.....

Your tables are set up so that:

tblCompany has two fields--ID and Name
tblPlanTypes also two fields ID and Name

But then TblPlanName has four fields--ID, fkCompany, fkPlanType and the PlanName


Mine are not like that but should they be??

My tblCompany has the same two fields as yours
My tblPanType has THREE-- ID, fkCompany and the PlanTypeName
My tblPlanName has THREE--ID, fkPlanTypeID and the PlanName

I am guessing mine are wrong somehow--but they are currently working on a nifty form that let me choose the company, then add their plan types and the plan names (one main form two subforms) I did not create this form soooo if I break it I'm in trouble. I just spent two hours sorting out plan types from plan names. You have yours exactly as they should be and I straightened mine around finally.


So anyway----should I change my Plan name table to include all four fields like yours and put my plan type table down to two fields? What's the best approach for long term use? I am guess your third table acts a junction? Maybe?



Help.....

Just when I thought I could get started on this, I am back to square one.

Thanks Bernie smile.gif

pere_de_chipstick
Hi Kathy

I believe the implementation I gave you is the correct one as it follows normalisation rules ie the Plan Type is independent of any company - You want to be able to see what companies can deliver what particular plan types hence table 3 shows the companies with their plan types and the plan names.

The list of which companies can deliver which plan types, is derived from this table using a group by in the query to remove repeated records being returned.

Your db should include a form bound to this table, and allow you to select the company and plan type, and add the plan name.

hth
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.