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

Combobox value is wrong

Hello all,
On my form I have an unbound combobox based on a query displaying two rows.
The rows are : 1) Zipcode (Leftmost (In the query this field is sorted
ascending
2 City

The BoundColumn property is set to 2, because the value of Citymust appear
in another control
When selecting a unique zipcode there is no problem, it does what is
expected but ...

Now lets' say that I have displayed :

2030 Zottegem
2040 Antwerpen
2040 Berendrecht
2040 Lillo

When clicking on any 2040 value it will always give Antwerpen as its value,
obviously the first in the alabetic order. What is it that I am doing wrong
?
Any help appreciated ... thanks
Ronny


Nov 12 '05 #1
3 6075
You don't need to bind the 2nd column to get its value to appear in another control. It is
true that the value of the combo box is based on the bound column, but you can get the
value from any column using the .Column property instead of the .Value property. So, if
you bind to the first column and want the value of the 2nd displayed in a textbox you
could use something like

=Me.cboMyCombobox.Column(1)

Yes, use 1 to get the value from the 2nd column. The index is zero based.

--
Wayne Morgan
"Ronny Sigo" <ro********@skynet.be> wrote in message
news:3f***********************@reader2.news.skynet .be...
Hello all,
On my form I have an unbound combobox based on a query displaying two rows.
The rows are : 1) Zipcode (Leftmost (In the query this field is sorted
ascending
2 City

The BoundColumn property is set to 2, because the value of Citymust appear
in another control
When selecting a unique zipcode there is no problem, it does what is
expected but ...

Now lets' say that I have displayed :

2030 Zottegem
2040 Antwerpen
2040 Berendrecht
2040 Lillo

When clicking on any 2040 value it will always give Antwerpen as its value,
obviously the first in the alabetic order. What is it that I am doing wrong
?
Any help appreciated ... thanks
Ronny

Nov 12 '05 #2
> Now lets' say that I have displayed :

2030 Zottegem
2040 Antwerpen
2040 Berendrecht
2040 Lillo

When clicking on any 2040 value it will always give Antwerpen as its value,
obviously the first in the alabetic order. What is it that I am doing wrong


The combo box is behaving normally. When a value is selected, it will always
fall back to the first instance of the bound column's value. It would appear
that you must either create a unique record identifier for each entry (bound
column - the value you would store) in the list, or you must store the city in
another field (the zip code control could be a typed-in value in a textbox or a
combo box listing distinct zipcodes and the city combo could display a filtered
list of cities, filtered on that zipcode field's value).

--
Bruce M. Thompson
bt******@mvps.org (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #3
Thanks guys !
"Wayne Morgan" <co***************************@hotmail.com> schreef in
bericht news:GI*****************@newssvr32.news.prodigy.co m...
You don't need to bind the 2nd column to get its value to appear in another control. It is true that the value of the combo box is based on the bound column, but you can get the value from any column using the .Column property instead of the .Value property. So, if you bind to the first column and want the value of the 2nd displayed in a textbox you could use something like

=Me.cboMyCombobox.Column(1)

Yes, use 1 to get the value from the 2nd column. The index is zero based.

--
Wayne Morgan
"Ronny Sigo" <ro********@skynet.be> wrote in message
news:3f***********************@reader2.news.skynet .be...
Hello all,
On my form I have an unbound combobox based on a query displaying two rows. The rows are : 1) Zipcode (Leftmost (In the query this field is sorted ascending
2 City

The BoundColumn property is set to 2, because the value of Citymust appear in another control
When selecting a unique zipcode there is no problem, it does what is
expected but ...

Now lets' say that I have displayed :

2030 Zottegem
2040 Antwerpen
2040 Berendrecht
2040 Lillo

When clicking on any 2040 value it will always give Antwerpen as its value, obviously the first in the alabetic order. What is it that I am doing wrong ?
Any help appreciated ... thanks
Ronny


Nov 12 '05 #4

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

Similar topics

8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
4
by: Keith | last post by:
Hello - this started out as a minor annoyance - and now is starting to bother me more and more - I'm hoping someone can help me. I would like to have a combobox display - NOT initially be blank...
0
by: dbuchanan | last post by:
ComboBox databindng Problem == How the ComboBox is setup and used: My comboBox is populated by a lookup table. The ValueMember is the lookup table's Id and the DisplayMember is the text from a...
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
7
by: Simon Verona | last post by:
I posted this in dotnet.languages.vb.controls but thought I'd post here as well.. I have a combobox that is bound to a dataview generated from a dataset. The dataset has a single table...
5
by: Peter M. | last post by:
I'm struggling with combobox databinding with something I consider a bug... I'm binding my combobox to an array of structs. The struct exposes two public properties, ID and Name, to be used as...
1
by: fiaolle | last post by:
Hi The first set of source code is the class for a combobox in a grid, hopefully. In the second set of code we try to use the combobox class, but the grid is empty. I don't understand how this...
0
by: Frnak McKenney | last post by:
Can I use a bound ComboBox for both browsing and editing? I'm working on a small, standalone database application using Visual C#.NET 2003 and an Access data file. In order to keep the number...
4
by: Jerad Rose | last post by:
I'm baffled by this -- is there not a typed object used for ComboBox Items? Best I can tell, all of the methods for ComboBox that accept an Item are of type Object. Why in the world is a...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
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...
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.