473,394 Members | 1,749 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

173 100+
Hi,

a simple one...........

i have a combobox with a list of line providers....... (from table tab_data).....

BT is one of the providers...........

In the list it shows BT several times, how can i limit this to one? i dont want replica data in the list............
Jan 8 '07 #1
5 1491
nico5038
3,080 Expert 2GB
The problem of this lies in the data in your table, let's assume the table look like:
1 BT
2 XYZ
3 BT
Then BT will appear 2 times. I would have define a unique index on the company name, to prevent that users enter the same company twice. When you have this in your table you have two options:
1 Qualify the names to make them unique like:
1 BT World Wide
2 XYZ
3 BT US
2 Use a GroupBy query, but then you need to decide which code to use like:
select Max(code), company from tab_X group by company
that gives for yor combo:
2 XYZ
3 BT
Or
select Min(code), company from tab_X group by company
Giving:
1 BT
2 XYZ
It's not possible to have two values for one field in a GroupBy....

Nic;o)
Jan 8 '07 #2
NeoPa
32,556 Expert Mod 16PB
In a QueryDef, if you look at the properties of the QueryDef itself, you will see Unique Values and Unique Records. These can also be used to remove duplicates from a simple SELECT type query.
Jan 9 '07 #3
Killer42
8,435 Expert 8TB
In a QueryDef, if you look at the properties of the QueryDef itself, you will see Unique Values and Unique Records. These can also be used to remove duplicates from a simple SELECT type query.
But how do you put them in an SQL string?
Jan 9 '07 #4
hariharanmca
1,977 1GB
Hi,

a simple one...........

i have a combobox with a list of line providers....... (from table tab_data).....

BT is one of the providers...........

In the list it shows BT several times, how can i limit this to one? i dont want replica data in the list............

then use the distinct QRY Like

========================QRY======================


strSql="Select distinct FieldName from TableName"
Jan 9 '07 #5
NeoPa
32,556 Expert Mod 16PB
then use the distinct QRY Like

========================QRY======================


strSql="Select distinct FieldName from TableName"
That's right - You can use the DISTINCT and DISTINCTROW predicates within the SELECT clause.
Jan 9 '07 #6

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

Similar topics

13
by: Mr. B | last post by:
Here's the situation... You've a combobox with Items already added. Say they look like this (or even lines of text): 10-00-232 10-00-256 10-01-006 10-01-213 10-02-200
7
by: Nicolae Fieraru | last post by:
Hi All, I am trying to change the rowsource of a combobox when I click on it. I played with many events, associated with the form and the combobox, but still haven't figured out what is the way...
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...
1
by: anonymous | last post by:
I've been trying to put a them, please help me out. Here's the major parts of my code: public Form1() { DataSet myDataSet = new DataSet("myDataSet"); DataTable testTable = new...
3
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article:...
2
by: Don | last post by:
I've looked high and low for some code that will allow me to have a combobox with a flat borderstyle. I found a few examples, but nothing that was really usable for me. I had the following...
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...
6
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
1
by: polocar | last post by:
Ciao a tutti, leggendo qua e lą per il forum ho scoperto che non sono l'unico ad avere questo problema. Se si inserisce un controllo ComboBox in un form di C#, non č possibile impostare la sua...
5
by: Rich | last post by:
Hello, I have a search application to search data in tables in a database (3 sql server tables). I populate 2 comboboxes with with data from each table. One combobox will contain unique...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.