473,707 Members | 2,285 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cascaded combo boxes not refreshing

23 New Member
Sorry, I've been posting alot of questions regarding cascaded combo boxes here but each time I solve one problem I seem to be faced with a new. This time here's the problem: I've got the combo boxes more or less working but they don't refresh. I'm only allowed one chance to choose the value in the first combo box. If I try to change it to another value, the second (dependent) combo box only displays the options from my first choice in the first combo box. This repeats itself when I navigate to enter a new record. I attempted to put the following code in the Current Event of the form's property:

Private Sub Form_Current()
Me.Product.Requ ery
End Sub

But doing this somehow erases the availability of any choices in the second combo box. This is yet another very frustrating problem and any help would be most appreciated.
Oct 10 '07 #1
11 2327
nico5038
3,080 Recognized Expert Specialist
In the first combo's AfterUpdate event you need to requiry the second combo like:
Me.cmb2.requery
or when that doesn't work use;
Me.cmb2.records ource = Me.cmb2.records ource

Nic;o)
Oct 10 '07 #2
seangibson
23 New Member
I'm sorry to report that neither of those solutions worked. Once I make a choice in the first combo box, the second combo box then has an unchangeable set of choices, both in the current record and in the next one. Any more ideas?
Oct 11 '07 #3
seangibson
23 New Member
Tell a lie - it works! I misunderstood your post and thought I needed to get rid of the On Current property. It's now functional (finally!0 - I think. I just need to make the first combo box come up blank when I navigate to enter another record. That shouldn't be dificult, right? Only I'm not sure h ow to do it...
Oct 11 '07 #4
seangibson
23 New Member
And yet another - it's now populating my table with the ID. I tried changing the bound column to 2, but when I do this the 2nd combo box no longer displays any options. I'm very close to tears now, having been working on this thing for days, only to encounter new problem after old one. ...sigh...
Oct 11 '07 #5
nico5038
3,080 Recognized Expert Specialist
Is your second combobox "bound" (has a fieldname as controlsource) and your first combobox not ?

Nic;o)
Oct 11 '07 #6
seangibson
23 New Member
Both control boxes are bound, each to a different field in the same table.
Oct 11 '07 #7
nico5038
3,080 Recognized Expert Specialist
Hmm, can you post the recordsource for the second combobox ?
Looks like it references the value in the record and doesn't "see" the changed value in combobox 1.

Nic;o)
Oct 12 '07 #8
seangibson
23 New Member
This is what I see in the Row Source property in the second combo box:
Expand|Select|Wrap|Line Numbers
  1. SELECT Products.ProductID, Products.ProductName, Products.CategoryID FROM Products WHERE (((Products.CategoryID)=Forms![enter new trade]!Category)) ORDER BY Products.ProductName;
Oct 12 '07 #9
nico5038
3,080 Recognized Expert Specialist
Hmm, that's the correct code.
But we might have a problem with the fact that both combofields are "bound".
Access will place the value of the record in the combo, and having the above recordsource wouldn't need the OnCurrent to requery the second combo.

There is however a problem when the value of the second combo is removed from the set defined by the first combo. This will cause the combination in the record to be "illegal".
Sample:
You have these cascading values:
MainCat / Subcat
A / 1
A / 2
B / 1
and in a record "A / 2" is stored. Now the combinations are changed into:
MainCat / Subcat
A / 1
B / 1
B / 2
This will cause the stored record to hold "conflictin g" information :-(

The solution for this is to record the combinations with a unique ID and use the combo's to store just one field (that unique ID). Now a combination can be changed for that ID, or you'll get a warning when removing such an ID when it's defined with a referential integrety relation.

It will however require quite some additional coding, as the first combobox can't be bound anymore and will have to be filled with the correct "MainCat" in the OnCurrent event, based on the value determined by the ID from the bound combo2.

Getting the idea?

Nic;o)
Oct 12 '07 #10

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

Similar topics

0
3534
by: Krisa | last post by:
Hello all, I just discovered something (stop me if you've heard this before....) that was causing me a significant performance hit when opening a form with subforms. To speed up loading the form, I set the rowsources of its, and its subforms', combo boxes in the "Enter" events of the combo boxes. That's the standard trick for not loading the rowsource unless/until the user actually needs the combo box. For example:
2
1984
by: taras.di | last post by:
Hi everyone, I've been reading up on how to create a drop down box who's context is dynamically produced based on the value of a previous select box. I've read a lot about some of the browsers not properly readjusting the width of a dynamically produced drop down box, and some browsers having problems adjusting the height and widths (most notably NN). Most solutions involve manually refreshing the browser window and/or padding the...
5
2244
by: Ant | last post by:
Hi, (Winform VS2003) I have a combo box bound to a typed data set. When the form loads, the combo box is popluated using a method containing the simple code below: ------------------------ // Fill the datasets for the combo boxes daDepartment.Fill(dsDepartment.Departments);
0
1602
by: Tom | last post by:
I have some very strange issues with combo boxes on a tab control. Here's the scenario: I have a Windows Forms form that has a tab control on it, with two (2) tabs. Tab 2 happens to have a number of text and combo boxes on it (in panels on the tab). These combos were originally simple drop down lists - i.e. you had to select from the list and couldn't enter anything of your own. At that time everything worked fine. Now, the users...
2
2643
by: Pablo | last post by:
I have a Continuous Form based on the following table: sku, description, categoryId, subCategoryId I restrict the initial dataset to include one value for categoryId, but it may include differing valuse for subCategoryId. The user needs to be able to modify either Category or SubCategory. I have placed two combo boxes on the form, they are query based and linked to the two Id columns. The cboCategory displays category names
4
2360
by: Dave | last post by:
I wasn't sure how to search for previous posts about this, it felt real specific. Ok so here's the database & problem: I have 4 combo boxes: cboServer, cboPolicy, cboDB, and cboApplication. The idea behind the database is for a user to search/ select desired information in any kind of combination between the 4 combo boxes. Then the user clicks a button (btnSearch) and subsequently a query ("Search Function") is run that shows all 4...
6
3679
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
1
2907
by: Dave | last post by:
Hello all, First I'd like to apologize...This post was meant to be put in my previous post, but I tried many times without success to reply within my previous post. Now here goes... I have a main form (RD Form) with 4 combo boxes (i.e. cbo1, cbo2, etc) and a subdatasheet (the subform...let's call it subInfo) below the combo boxes on the RD Form. I hope this eliminates any confusion of the
2
3268
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once selecting from the combo box, I have all the combo boxes, using afterupdate, populating their respective list boxes. These text boxes are directly correlated to the combo box selection using SQL. Here is an example from the afterupdate event in the...
0
8787
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8697
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9158
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9060
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7921
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6615
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5939
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2508
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2096
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.