I have a question regarding "cascading combobox(s) list(s)"
I would like:
ComboBox 2 to show results from ComboBox 1's selection,
then ComboBox 4 to show results from ComboBox 3's choice
For Instance these are the combo boxes
[category] [subcategory] [type] [subtype]
This is the sample of choices in the combo boxes
HARDWARE - CABLES - USB - 2.0
HARDWARE - CPU - AMD - AM2
QUESTION(s)
Do I create ONE table for this? OR
Do I create 4 tables = tblcategory tblsubcategory tbltype tblsubtype ?
Do I place a QUERY in the middle of the TABLE(s) and the FORM?
Should I use VBA to make this work?
Should I use sql in the control source to make this work?
What is the best solution? so many answers, so many posts,..
a lookup in a table field.
Hello,
thank you for your reply FishVal, I appreciate it.
that article you gave me is excellent.. I found it yesterday.
HOWEVER it deals with 2 comboboxes
Company and Employees
I have 4
category subcategory type subtype
and I really don't know how to make this VBA code go past 2 columns, it only deals with 2.. Company and Employees
would I add another ELSE section? or just make another module for type!?! i think I am getting it!
Hi, there. I really don't understand your difficulties.
Place the folllowing code in AfterUpdate event handlers of each combo but the last one. Assumed you are going with table structure I suggested in post#2 and combos are 2-column (keyCategoryID, txtCategoryName), the first is bound and invisible (column width is set to 0).
"WHERE keyParentCategory=" & Me![<level N combo>] & ";"
End If
Call .Requery
End With
End Sub
Other options:
you have 1 combo which changes it's own RowSource in AfterUpdate to walk down the tree; this case you should think how you want to walk up level one or/and to the topmost categories level
you use treeview control to browse through categories
AH HA!!! now I get it! I took one look at it and now I totally understand..
I am visual.. I had to see an example of it to understand. +
however I dont understand what you mean by flat... when you mention
"so far the categories list is flat,"
AND
" to make it more representative in table view add lookup feature to the field"
AH HA!!! now I get it! I took one look at it and now I totally understand..
I am visual.. I had to see an example of it to understand.
Thats good.
however I dont understand what you mean by flat... when you mention
"so far the categories list is flat,"
I mean that with the first two fields you get table where all categories are equal, no levels defined. The third field - [keyParentCategory] adds levels.
AND
" to make it more representative in table view add lookup feature to the field"
Make [keyParentCategory] as Number/Long field, then go to "Lookup" tab and set
Display Control = Combo Box
Row Source Type = Table/Query
Row Source = SELECT tblCategories.* FROM tblCategories;
Bound Column = 1
Column Count = 2
Column Widths = 0";2"
the rest as you like
this will transform [keyParentCategory] field in table view from textbox to combobox, the drawback is that having added new records you'll need to reopen the table to require the combo.
You may stay without lookup feature and write numbers to [keyParentCategory] field, this case no need in table reopening.
Or you may design form where combo rowsource will be required automatically.
I don't mean to disturb the conversation here, but there is another article (Example Filtering on a Form.) that may also help. It goes through adding multiple ComboBoxes to filter the data as per the selection.
Please ignore if this would only complicate matters, but you may find it helpful.
FishVal, you rock..
I am going to print this out, go to the coffee house.. come back and try it!
thank you FishVal.
you ever on the gold coast of Australia let me know!
being the newbie I am, I was getting errors with what i copied and pasted from FishVAl and at 2am in the morning i was just ready to just use a WAMP in a VMWARE machine and switch over to MySQL using MyPhpAdmin and php w/ XTHML + CSS with a pretty web2.0 interface and maybe some spry.. using dreamweaver and Adobe Dreamweaver Developer Toolbox,
( yea that sounds complex but i am finding the comboboxes in access hurt my brain more! HAHA )
I CANNOT imagine debugging the fallowing until i learn the basics.
I suggest you put your actual project aside for a bit while you progress through this article. It's a bit like a tutorial and includes the database to download.
If you have trouble with it or specific questions, I can help. I expect once you start to go through it it will start to make better sense.
Hello NeoPa,
thank you for offering to help. You are a scholar and a gentleman
It doesn't look that bad, I just may read and study.. just noticed like in CSS the
lines that start with a ' is a comment */ comment */ so there is not as much code as i thought.
One thing, It is 2007, things are going FAST.. guys like me DONT HAVE TIME, especially trying to debug code and it ends up being a comment out of place. then you have to search for help on the obscure ms error message.
Trying to stay ahead of the game is almost information overload, you miss a beat and your behind, I have learned to KEEP IT SIMPLE
you get IN and you get OUT.
I could and actually will spend another 2 days figuring this out, then I get it done.. enter data and don't dive into the code again till i want to customize it or something isn't right..
this is one reason allot of people use FileMaker, they get frustrated with access and filemaker you get in and get out. but once your in your in!
by the way, i did have my doubts with going with access 07, there is not a access 2007 export to MySQL yet, but you can always make table etc etc.
No space before the FROM (or the WHERE for that matter).
@Gold Please notice that two of your posts now have the edit comment (Please use [code] tags).
This is because everything works so much better when you can read what's being posted. I'm sure Fish would have seen the missing space if it had been laid out clearly.
*edit* I just noticed a later post indicating you're obviously trying. Look at the (#) button when creating or editing your post and read the text at the right on the "New Post" page for hints :)
Please check out post #19 where it talks about using [ CODE ] tags in your posts. I've had to edit your post again and frankly I'm getting tired with tidying up after you.
Also, if you'd like me to continue working with me I'd appreciate feedback related to my posts. Explaining where you are from scratch (as you seem to have in your last post) is frustratingly difficult to follow.
How would you communicate with someone when they appear to ignore everything you try to tell them and just go on their own merry way regardless. It's not good manners and it's very difficult for me to be of any use to you.
I still don't know if you've understood my first point yet and, regardless of whether you work by jumping around from issue to issue, I know better, so don't expect me to follow you.
OK! I think I got it! (including putting the code in the code tags for neopa) I think I got comboboxes to filter using querys to last combobox then last combobox populates the remaining columns in table!
you have taught me well FishVal.
this solution uses hardly ANY vba and writes TEXT to record instead of ID number.
The fallowing comboboxes are cascading comboboxes and filter to comboprodname. using 5 querys.
Expand|Select|Wrap|Line Numbers
Combocategory
Combosubcategory
Combotype
comboboxsubtype
Comboprodname
When item is selected in comboprodname combobox..
Then the remaining fields in table (which are each bound in control source)
are populated VIA vba!
The remaining text box fields on form are
Expand|Select|Wrap|Line Numbers
Description
Make
Model
UnitPrice
purchasedPrice
So VBA in afterupdate in Comboprodnamewhich is the
LAST combobox should look something like this?
Ok, I am with you. I will start using the code tag with the editor
Gold,
I think I needed to say what I had to say, but I'm pleased to see that it hasn't curbed your enthusiasm.
I'm very pleased that you managed to resolve your issues (mainly with FishVal's help - He's good that chap). I was also pleased that your explanation (which is always appreciated from posters after a successful resolution) was expressed clearly and was easy to read and understand.
Please come back and post if you have further issues :)
I got one more for you before i experience even more JOY! ( oh and there was joy when It all worked, when i closed one eye and clicked and held my breath and it worked i woke the neighbors)
Also, I understand VBA now thanks to you guys. i remember picking up the ACCESS 2007 books and seeing the VBA code i would stop and say "give me a break" I actually go back now and open the same books and understand it now! what a TRIP.
Comboxes are working great.. when I add products. and as a new database, I am finding errors and renaming categories. is there a bit of code
that I can add to the VBA that will clear the boxes AFTER?
EXAMPLE
HARDWARE | CPU | AMD | AM2 | CHEAP
lets say I want to change AMD to INTEL
when I go back and change HARDWARE in first combobox, it dynamically clears all of the fallowing combboxes?
Expand|Select|Wrap|Line Numbers
[cboSubCat] [cboType] [cboSubType]
HARDWARE | nothing | nothing | nothing |
Also, I am not using the Querys anymore! only for the first combobox.
[cboCat]
here is the code I am using now
Well Gold, It's certainly fun when you get something working and I'm glad you've had that satisfaction (and especially the extra time with your kids).
As to your combobox behaviour, every time you select an item from any of the comboboxes it will start the others (lower down the tree) again from scratch. As you can see this will happen both when the field is redone (.RowSource reset) and when a new item is selected.
Hey,
I've done a number of product catalogs/galleries with one or two
category levels (Category > Subcategory). The straightforward way to do
this, of course, is to use database fields for...
Hello,
So my table contains say 100,000 records, and I need to group the
categories in fld1 by the highest count of subcategories. Say fld1
contains categories A, B, C, D, E.
All of these...
I have a form with data from a box (Table box), on his form is a
subform with the instuments that are in this box. The instruments
(Table instruments) are categorized by category (Table Category)....
I have a strange situation using Access to automate a Word mail merge. Using
Access 2000 and Word 2000, the code opens Word, opens the document in Word,
sets a table
in the calling Access...
I am trying to create a nested DataList with multiple subcategories listed
under each primary category. Unfortunately, I end up with a bunch of
multiple SubCategory values after iterating through...
Hi
Im am implementing a small database system using MS Access.
I have two main fields: :product category and product type!
Product category contains ABC and XYZ categories. I added both in the...
Hi, I hope someone can help me sort this out a bit, Im completely lost.
Here is the page I am working on:
http://www.knzbusinessbrokers.com/default.asp
I have 3 search critera that I need to...
I have an ASP file that retrieves names from an Access database for 4 different categories of membership, which the visitor to the page selects (corporate, institutional, regular, or student). The...
Wondering is this is possible - I have 2 tables. One is categories,
and has catid, catname, hashighercat, and ...I can't think of the 4th
one, but it isn't needed anyway.
There are 40...
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...