473,434 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

Cascading Filtering

Okay, I'm sorry, but I lied. I need to ask one more question regarding my database. This has to do with the three cascading combo boxes mentioned in my original question. I mimicked my way through creating three cascading combo boxes from solutions to questions others asked. They work great for the most part, even though I don't really understand why or how they work. However, there is one problem.

I need to be able to choose a blank for the second or third combo box if there are no applicable choices available for those companies, which happens often. For example, if there are no division choices for the second combo box and I pick the blank, upon tabbing to the third combo box, I get a error popup that says, “Syntax error (missing operator) in query expression ‘[DivisionName]=’

And if there are no choices applicable for the third combo box [cboLocations], the dropdown list shows choices from the last entry that did have choices even though they are not applicable. I need both combo boxes to allow me to choose a blank choice if that is the appropriate answer for that company. Below is what I currently have:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboCustomers_AfterUpdate()
  2.        ' Update the row source of the cboDivisions combo box
  3.     ' when the user makes a selection in the cboCustomers
  4.     ' combo box.
  5.     Me.cboDivisions.RowSource = "SELECT DivisionName FROM" & _
  6.                                " DivisionTable WHERE Customers = " & _
  7.                                Me.cboCustomers & _
  8.                                " ORDER BY DivisionName"
  9.  
  10.     Me.cboDivisions = Me.cboDivisions.ItemData(0)
  11.     Me.cboDivisions.Requery
  12.     Me.Customer = Me.cboCustomers.Column(1)
  13. End Sub
  14.  
  15. Private Sub txtSendKeys_GotFocus()
  16. Private Sub cboDivisions_AfterUpdate()
  17.   With Me![cboLocations]
  18.     If IsNull(Me!cboDivisions) Then
  19.       .RowSource = ""
  20.     Else
  21.       .RowSource = "SELECT [Locations] FROM LocationsTable WHERE [DivisionName]=" & _
  22.                     DLookup("[DivID]", "DivisionTable", "[DivisionName] = '" & Me![cboDivisions] & "'")
  23.     End If
  24.     Call .Requery
  25.  
  26.   End With
  27. End Sub
Is it possible to fix this problem? Please, please help again!

**Edit**
This new question has been split from How to combine five data fields into one string for a new field.
Jul 26 '10 #1
9 1762
NeoPa
32,556 Expert Mod 16PB
01:00 is not a good time to drop this on me. I will need to move it to a separate thread and add all the linking between threads that you should have done. When I've done all that I will certainly look at your question. It'll all have to wait until tomorrow though I'm afraid.
Jul 27 '10 #2
@NeoPa
I am so sorry NeoPa. Looks like I did everything wrong after you were so wonderful in helping me the first time. I am new to this website and it's rules. I am in California and didn't realize that you are in the UK when I sent the email at 5:00 p.m. PST, plus I certainly didn't realize that any communication I sent would wake you. Yikes! I've even been afraid to send this apology for fear of doing something wrong again. Please let me also add my regrets for not knowing I should have moved my question to a "new thread", but I don't even know what a "thread" is. Please accept my sincere apologies.
Jul 27 '10 #3
NeoPa
32,556 Expert Mod 16PB
Ha ha. Very good :D You'll give me a complex.

I was being somewhat tongue in cheek (I hope you realised) about the time thingy, and I was just explaining why I wasn't able to get to it there and then. I don't really expect posts only to come in during my time-frame. It would make a strange forum if it worked that way. Sometimes I remember too late that joking around is harder to see when :
A. It comes from an Administrator
B. It's visible only in text, without any tonal or visual clues.

I also expect to have to nudge new members a few times before they are fully aware of all the main rules.

Rest assured, as far as I'm concerned you're still a very pleasant member to deal with and incoming posts don't wake me in the middle of the night. I was up anyway, just feeling the need for some zzz by then.

I still intend to get to this shortly. I expect to have some time free this evening for Bytes work (I rather ran out of lunch-hour some time back).

When I get around to it you'll be notified about the change and you should be able to find the new thread easily so there shouldn't be any need to worry.
Jul 28 '10 #4
NeoPa
32,556 Expert Mod 16PB
Right, I can start to look at this properly now.

I think the first thing we'll need to do is tidy up some of the code, and maybe clarify exactly what you're after. Line #15 starts a procedure, then line #16 starts another one (without the previous one being completed anywhere). Also there seems to be code only for cboCustomers & cboDivisions. Nothing for cboLocations, and nothing to show what the eventual filtering is for (I imagine the three ComboBoxes are there to filter something).

I'd like to know what the ComboBoxes are designed to filter.

Lastly, this concept (of filtering when something exists but also handling non-existent items where necessary) is perfectly manageable. It's only the lack of understanding of what the actual issue is that stops me suggesting a solution now.
Jul 28 '10 #5
@NeoPa
Thank you NeoPa for tackling my clumsy questions again. I’ll try my best to answer your questions and make sense at the same time, but can only hope for total success at the "make sense" part. ;-)

Our company makes component parts for other companies (our “customers”). The purpose of this database is to track the heritage of those components, as well as the amount and type of business we do with each customer. I am lucky in that although our company has been in business for decades, this database will be the first centralized tracking tool utilized for this purpose and I am therefore free to organize it as I see fit. In the past, without a central data depository, every individual in the company kept their own records in their own personalized format. As a result, it’s nearly impossible to tell for instance how many different components we have made over the years for Acme Widget Corporation because some people have recorded the customer’s name as either “Acme”, “Acme Widget”, “Acme Widget Corp.”, or even “AWC”. Additionally, some customers have multiple divisions that we contract with separately from the rest of the client company. The Submarine Division of Acme has little or no connection to the Satellite Division, however, not everyone in our company bothers to specify which division, if any, we are contracted with when recording data. Then as a final complication, some customers have multiple physical locations, but only one division, and some might have multiple divisions that are all in one location, but do business separately from each other. Clear as mud?

Anyway, my goal is to standardize, specify, and identify each client company uniformly across the board. I want anyone using the database to be forced to use only the predetermined authorized format to identify a customer. So I thought cascading combo boxes that limit a user to a list would work best. I don’t want anyone to be able to skip making a deliberate choice in all three combo boxes. When recording a new component in the database, I need a user to be forced to first choose a client company’s name from the initial dropdown list [cboCustomers], then either have to choose a division name or choose a blank when there is no division name from the second combo box [cboDivisions], and lastly to choose a location if one is applicable or choose the blank option if appropriate from the third combo box [cboLocations]. The three boxes together should force a consistent and clear identification of each customer we are contracted with for each component. All three combo boxes have their Control Source in the main table named ComponentsAndAssemblies.

I’m afraid that I cannot answer your question about there being no code for cboLocations. I copied and pasted code from a number of other cascading combo box examples, substituting their combo box names, etc., with my names in order to get these cascading combo boxes to work at all. If I saw that someone else online was having the same problem as me, I would copy and paste that little bit of solution code into mine to see if it would help fix my problem. So I’m not surprised at all if there is code in my combo boxes that does nothing or creates a problem. I can’t even pretend to understand the code in any way, shape, or form. It’s like having learned to sing along with a song being sung in Latin verse even though I don’t understand one word of Latin!

Thanks again NeoPa for your patience with me. Please let me know if I need to clarify anything further. I will certainly give it the old Latin try!
Jul 29 '10 #6
NeoPa
32,556 Expert Mod 16PB
That was very clearly explained, and gives me almost all I need to know.

Normally, I wouldn't get in to quite so much detail as I'm about to on this. The fact that I choose to on this occasion is that you've been clear and honest with me about your problem as well as your understanding of the issues. Hopefully, I can help with the particular issue as well as help you to understand the issues a little better.

With this in mind I will go off and prepare some initial questions about your form etc, and what you're hoping to end up with. Can I suggest to you though, in the mean time, to have a look through the following tutorial (Example Filtering on a Form) and have a bit of a play with it. It has a database you can download. See if you can get to grips with some of the concepts outlined in the tutorial as I believe this will help directly in understanding what we are about to work on in your own database.
Jul 29 '10 #7
NeoPa
32,556 Expert Mod 16PB
So far, we have little or no information about the layout of the [ComponentsAndAssemblies] table. We will need some metadata I'm sure.

This will work much better if you can post the meta-data (info about the layout / structure) of the table in the same way as I use in my example. Click on the Reply button (and then Advanced) and you will have access to all the codes I've used. PK & FK stand for Primary Key & Foreign Key respectively. Never use TABs in this as the layout gets mucked up. Use spaces and all is fine (Remembering of course, that BB Code takes up no space in the resultant post).
Table Name=[tblStudent]
Expand|Select|Wrap|Line Numbers
  1. Field           Type      IndexInfo
  2. StudentID       AutoNumber    PK
  3. Family          String        FK
  4. Name            String
  5. University      String        FK
  6. Mark            Numeric
  7. LastAttendance  Date/Time
Moving on. I get that you want to identify the customer at the proper detailed level (including division and/or location where they exist), but I don't know how this would fit onto the form as I know nothing about the table your form is bound to (other than it's for entering new components). If you could provide the name and metadata for that table too, that would be quite helpful.

Lastly, I would need the names of any relevant controls on the form. I can only think of a control for storing the ID for the Customer/Division/Location for now. If anything else occurs to me I'll let you know. Actually, depending on how your data is structured it may be the case that cboLocation reflects this value, but I expect otherwise. let me know anyway.
Jul 29 '10 #8
@NeoPa
NeoPa:

I have been trying all day to no avail to get a chance to respond to your requests because I will be out of the office until next Monday. I have now run out of time and have to leave. I hope you don't mind that I will not be able to respond to your requests until Monday at the earliest. You have certainly been more than patient with me already, and I thank you. Hope you have a good weekend!
Jul 29 '10 #9
NeoPa
32,556 Expert Mod 16PB
I have a very busy weekend ahead and I'm struggling to keep up with a bunch of threads as it is due to various Admin level discussion going on heavily this week.

So, no. I'm not remotely upset to hear you won't be responding until Monday :D

Have a great weekend and relax about this. I have plenty to keep me busy.
Jul 29 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Humpty Dumpty | last post by:
Hi folks, here's a challenge: I have a dynamically created cascading menu in Tkinter that can be quite large because it is created from a file. I tried using lazy creation so only the menu item...
1
by: JMosey | last post by:
Not sure if this has been covered ( a google search came up pretty bare). I have a site that: - has multi-level cascading menus - floats center of the browser window - Will have fairly heavy...
2
by: Cameron | last post by:
Hi, For the database I am currently working on, my employer would like the ability to use multiple combo boxes in order to filter the database. For instance the structure of the company is based...
2
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would...
1
by: Webgour | last post by:
I'm tring to filter a dataview with multiple rowfilters. The problem is that each time I use RowFilter on the DataView i'm quering the full dataview as it was loaded, not the filtered version. Is...
3
by: Mike Jakes | last post by:
I hope that someone can offer a little advice on this one - I've searched the group but can't find an answer. I think that I'm doing something really stupid or missing something trivial, but see...
9
by: Radium | last post by:
Cascading Style Sheet is an extreme hazard to your privacy. It allows others on the internet to see your monitor and files. It allows them to copy images on your monitor to their computers. It...
0
by: visionstate | last post by:
Hi All, I have a few tiny problems left with my cascading combo boxes. Here is what my form looks like: http://img219.imageshack.us/my.php?image=databaseformwl5.png The way it works is by...
3
by: MOCaseA | last post by:
I have a record lookup form that has several combo box filters set up. However I noticed a slight problem. The filters are working correctly, but there are now over 2000 entries and when filtering...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.