473,395 Members | 1,452 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,395 software developers and data experts.

Disappearing Combo Box Values

So I have a subform that lists the various items on a particular
invoice.

First, the user selects a product class from the Class dropdown. This
is bound to the Class field in the InvioceLines table. The rowsource
for the combobox is:

ClassName, ClassID, ClassSort

from the Class table, with the bound column set to ClassID.

Depending on the class that the user selects, the options in the
Product dropdown change. The product dropdown is bound to the Product
field in the InvoiceLines table. The rowsource for the product
combobox is:

ProdName, ProdID, ProdSort, ClassID (where ClassID = [InvoiceLines].
[Form]![Class]), and I have ClassID related to ClassID in the Class
table in the query.

For the Class dropdown, I have the following AfterUpdate:

Me.Product = Null
Me.Price = Null
Me.Product.RowSource = "SELECT tblProduct.ProdName,
tblProduct.ProdID, tblProduct.ProdSort, tblProduct.ClassID FROM
tblProduct INNER JOIN tblProduct ON tblClass.ClassID =
tblProduct.ClassID WHERE (((tblProduct.ClassID) = [Forms]![Invoice]!
[InvoiceLines subform].[Form]![Class])) ORDER BY tblProduct.ProdSort;"

And the subform works just fine. When a user selects a class from the
class dropdown, it limits what appears in the product combobox. On the
next line, a user can select a different class, and then different
products appear in that line. Etc. Etc.

However, as soon as the subform loses focus, the Product field in the
subform gets blanked out except for the last record. Oddly, the values
for the blanked out fields are saved in the table, they simply do not
appear on the form. What you close out of the form and go back in, all
fields are blank except for the FIRST record.

Any ideas why this would be happening? It only seems to happen in
Access 2003, not in Access XP.

Mar 7 '07 #1
2 7491
It sounds like you are assuming that the row source should be
different for the combo box for each record because there is a
different class selected for each record. In fact, each time you
update the class you are requerying the product subform for every
record. The combo box row source is the same for every record, and
changes every time you change the class. The combo box rowsource only
occasionally includes the value you have entered there.

It shows in the last record, because that's the record that was active
when you reset the query. When you open the form, it sounds like the
requery is operating on the first record.

try this: make the combo boxes unbound. Make a new text box bound to
the product in the afterupdate for the product combo box, set the
textbox = combo box. -tc

On Mar 7, 9:58 am, dancol...@gmail.com wrote:
So I have a subform that lists the various items on a particular
invoice.

First, the user selects a product class from the Class dropdown. This
is bound to the Class field in the InvioceLines table. The rowsource
for the combobox is:

ClassName, ClassID, ClassSort

from the Class table, with the bound column set to ClassID.

Depending on the class that the user selects, the options in the
Product dropdown change. The product dropdown is bound to the Product
field in the InvoiceLines table. The rowsource for the product
combobox is:

ProdName, ProdID, ProdSort, ClassID (where ClassID = [InvoiceLines].
[Form]![Class]), and I have ClassID related to ClassID in the Class
table in the query.

For the Class dropdown, I have the following AfterUpdate:

Me.Product = Null
Me.Price = Null
Me.Product.RowSource = "SELECT tblProduct.ProdName,
tblProduct.ProdID, tblProduct.ProdSort, tblProduct.ClassID FROM
tblProduct INNER JOIN tblProduct ON tblClass.ClassID =
tblProduct.ClassID WHERE (((tblProduct.ClassID) = [Forms]![Invoice]!
[InvoiceLines subform].[Form]![Class])) ORDER BY tblProduct.ProdSort;"

And the subform works just fine. When a user selects a class from the
class dropdown, it limits what appears in the product combobox. On the
next line, a user can select a different class, and then different
products appear in that line. Etc. Etc.

However, as soon as the subform loses focus, the Product field in the
subform gets blanked out except for the last record. Oddly, the values
for the blanked out fields are saved in the table, they simply do not
appear on the form. What you close out of the form and go back in, all
fields are blank except for the FIRST record.

Any ideas why this would be happening? It only seems to happen in
Access 2003, not in Access XP.

Mar 8 '07 #2
Typo: I dropped a period. Should read:
try this: make the combo boxes unbound. Make a new text box bound to
the product. In the afterupdate for the product combo box, set the
textbox = combo box. -tc
Mar 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: AJ | last post by:
Hi all, I'm brand new at using Visual Studio, but I have basic programming knowledge from C++. I created a Windows form with some buttons, a tab area and tabs, and some combo boxes with a list...
0
by: John Wind | last post by:
Hello, I posted this problem in a thread on a seperate message, I'm not sure I did it right so I started a new message, sorry for any problem this has caused. This problem has me pulling my hair...
2
by: neptune | last post by:
I built a form to access a query with a 2 field primary key. It should use 2 controls to find the unique record and display the other field values on the form. In the criteria section of the...
6
by: Winshent | last post by:
I have read many threads which indicate that this was a problem with version 2002. Why should i be suffering this? I am using VB.NET 2003 Standard Edition... is it still a problem with 2003? ...
6
by: Jim | last post by:
I have a user control that I am dynamically loading into an aspx page. When I fill out the text boxes and submit the form using a command button on the aspx page I lose the value from the user...
9
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
3
by: jaad | last post by:
How can I help my the data from a combo box from disappearing when I change record? the data is coming from a query that is made to limit the value list of a combo box depending on the value of...
0
by: ryjfgjl | last post by:
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...
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
by: Hystou | last post by:
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...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.