473,405 Members | 2,160 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,405 software developers and data experts.

Cascade comboxes in a continuous form won't work

11
I am working on an order system. The following are the tables and forms.
Expand|Select|Wrap|Line Numbers
  1. (A) Tables:
  2. tblOrder: OrderID (PK), CustomerID
  3. tblOrderDetail: OrderID (PK), ProductID
  4. tblProduct: ProductID (PK), ProductName, CategoryID
  5. tblCategory: CategoryID (PK), CategoryName
Expand|Select|Wrap|Line Numbers
  1. (B) Forms:
  2. frmOrder (single column type with sub-form frmOrderDetail): OrderDate, CustomerID, CustomerID
  3. frmOrderDetail (of continuous type): CategoryID, ProductID  (both are combo boxes of control names cboCategoryID and cboProductID, respectively; cboCategoryID is unbound)
What I need: In the frmOrderDetail sub-form (may already have more than one row), select CategoryID in a row and the corresponding matched ProductID will show up in the combo list at the same row. Nothing will be affected in other rows. I have written a program for CategoryID in frmOrderDetail as follows. However, when I select a CategoryID all CategoryID in other rows are altered. Same thing happens to ProductID. The cascade combo boxes don't work: they interfere with each other. Any solutions?
Expand|Select|Wrap|Line Numbers
  1. ------------------------
  2. Private Sub cboCategoryID_AfterUpdate()
  3.    Me!cboProductID.RowSource = "SELECT ProductID, ProductName FROM tblProduct WHERE (CategoryID = Forms!frmOrderDetail!cboCategoryID);"
  4.  Me!cboProductID.Requery
  5. End Sub
  6. -------------------------
Aug 29 '08 #1
6 2062
Stewart Ross
2,545 Expert Mod 2GB
Hi. If you see the selections repeating for all occurrences of your combo boxes on the continuous form then your combos are unbound; that is, their control source property is blank instead of being set to a specific field in the underlying query or table on which your form is based.

Access implements a single instance of controls on a continuous form, and is only able to vary the values shown when the control is bound to an underlying field. Controls that are not bound show the same value down all rows of the continuous form, rendering them useless.

You will need to resolve this problem by binding the combos to the correct fields before you can do any more with the cascading selections.

-Stewart
Aug 29 '08 #2
yltang
11
Hi. If you see the selections repeating for all occurrences of your combo boxes on the continuous form then your combos are unbound; that is, their control source property is blank instead of being set to a specific field in the underlying query or table on which your form is based.

Access implements a single instance of controls on a continuous form, and is only able to vary the values shown when the control is bound to an underlying field. Controls that are not bound show the same value down all rows of the continuous form, rendering them useless.

You will need to resolve this problem by binding the combos to the correct fields before you can do any more with the cascading selections.

-Stewart

Hi Stewart,
Thanks a lot. I have added a Dummy field in tblOrderDetail table and bind it to the cboCategoryID combo box. Now, selecting an item in cboCategory will not change the values of cboCategoryID in other rows. However, when I make another selection of cboCategoryID in another rows, it will change the values of cboProductID in every row. How do I solve the problem? Thanks in advance.
Sep 1 '08 #3
missinglinq
3,532 Expert 2GB
cboProductID also has to be bound to a field, or the same thing happens!

Linq ;0)>
Sep 1 '08 #4
Stewart Ross
2,545 Expert Mod 2GB
Hi. Reviewing your first post in light of what you say about dummy fields I can't understand what you are trying to achieve here. If you have had to add dummy fields to bind your combos (by which I take it you mean that they are fields otherwise unused except to allow the individual combo selections to work) what was it you expected the combos to do for you in the first place?

Cascading combo selections are normally used to filter groups of records shown on forms and subforms, and in most circumstances their placement is at the level 'above' that of the records concerned.

-Stewart
Sep 1 '08 #5
yltang
11
Hi. Reviewing your first post in light of what you say about dummy fields I can't understand what you are trying to achieve here. If you have had to add dummy fields to bind your combos (by which I take it you mean that they are fields otherwise unused except to allow the individual combo selections to work) what was it you expected the combos to do for you in the first place?

Cascading combo selections are normally used to filter groups of records shown on forms and subforms, and in most circumstances their placement is at the level 'above' that of the records concerned.

-Stewart
Hi missinglinq and Steward,
Thanks first for your comments. To missinglinq: the cboProductID is also bound. To Steward: the main reason for using cascading combo boxes is indeed to filter the number of selection items. I think it is very common for an order system to limit the number of products for selection (imagine there are hundreds or even thousands of products!). One of the more efficient ways I can think of is to group products into categories. That's why I used cboCategoryID as the first combo box. After selecting the cboCategoryID combo box, the number of corresponding products will be much fewer. However, as I posted in the first question, using an unbound combo box for selecting categories won't work. Therefore, as suggested by Steward, I have to bind the combo box by using a Dummy field as a workaround. Sadly, the problem is solved only partially: the values in cboProductID in every row are changed due to the selection of the product categories. I hope that I describe the problem clear enough. Again, I list the main structures of the related tables:

tblCategory: CategoryID*, CategoryName
tblProduct: ProductID*, ProductName, CategoryID
tblOrder: OrderID*, CustomerID
tblOrderDetail: OrderID*, ProductID*, Dummy

The form for adding an order is a main single form (frmOrder) accompanied by a continuous sub-form (sfmOrderDetail). So, how do I add/select a product without having to scan tens, hundreds, or even thousands of products? I tried to use a combo box cboCategoryID (bound to a Dummy field in tblOrderDetail) to select the category of the product. And, supposedly, the proper products belonging to that category will show up in the combo box cboProductID, which is bound to ProductID in tblOrderDetail. The problem is that the values in cboProductID in every row get refreshed very time I make a category selection. So, how do I solve the problem? Thanks in advance.
Sep 1 '08 #6
Stewart Ross
2,545 Expert Mod 2GB
Hi. Well, you appear to be binding the wrong field here; if you are selecting products with your filtered combos it would normally be the product ID field in your subform that should be bound to the main selection combo. Using a dummy field is simply incorrect, no matter why you are doing so, as there is no relation between the actual product ID and your dummy field.

If you want to use two cascaded combos to select categories and products to make it easier for users to select the correct item on your order details form it would be better to have a single pop-up form for that purpose, opened from a selection button on your subform, instead of trying to place two combos on your subform rows and running into the difficulties you are currently experiencing.

I would urge you to consider again what it is you are trying to achieve, and how you are setting about it. I would also suggest you review the Northwind sample database supplied with Access, which shows examples of the use of subforms that might help you with simpler designs.

-Stewart
Sep 2 '08 #7

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

Similar topics

33
by: Lee C. | last post by:
I'm finding this to be extremely difficult to set up. I understand that Access won't manage the primary key and the cascade updates for a table. Fine. I tried changing the PK type to number and...
5
by: Armando | last post by:
I recently saw the tail end of a "Continuous forms" discussion, but not enough was available to see if this will be a PITA repeat question. Sorry if it is. On a form with its Default View...
4
by: Kathy | last post by:
What is the standard technique for handling the fields in the following scenario on a continuous form? Multiple Divisions. Each Division has multiple Buildings. Each Building has a Supervisor. ...
3
by: Tim Marshall | last post by:
HI all, Access 2003, Jet back end. Rather than annoy my users in a particular app by having relationships with enforced relational integrity refuse to delete a record with related records, I'm...
0
by: Jeremy Wallace | last post by:
Folks, Here's a write-up I did for our developer wiki. I don't know if the whole rest of the world has already figured out how to do this, but I hadn't ever seen it implemented, and had spent a...
26
by: Allen Browne | last post by:
In Access 2000 and later, you can create a relation between tables where related records can be automatically set to Null rather than deleted when the primary record is deleted. I have not seen...
2
by: eighthman11 | last post by:
Hello everyone. I thought I had a perfect plan but obviously I don't. I created a continuous form which list all our company's inventory. The Continuous Form has the Inventory Number, Description...
5
by: ApexData | last post by:
I have a Continuous SubForm on a TabPage. Above the ContinuousForm is a "box of fields" I use to display the entire record that the focus is on. When one points to a record using the...
6
by: RamonPV | last post by:
Hello: I am having a problem with to linked comboxes in IE7. Here is my problem that is ONLY ocurring in IE7: I have javascripts functions to populate the second of 2 comboxes given the selected...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
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
0
BarryA
by: BarryA | last post by:
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.