473,779 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ComboBox

ego
Hello again my friends,

My question is :

In a Combo - Box , based on a table with duplicate values.
How can I define the Combo -Box so she will show one example for each
value .
For example :

Internet site name , Subject of the internet site
A Technical
B Technical
C General
D General
E Fun
F Fun
The combo box will show : Technical, General, Fun.

I tried to go to the Query behind the ComboBox at to do A Group By
action,
But because the ComboBox required two fields : The primary key and the
subject field ,
It didn't work.

Please help me,

Ego

Nov 13 '05 #1
10 1931
"ego" <ki*****@hotmai l.com> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com...
Hello again my friends,

My question is :

In a Combo - Box , based on a table with duplicate values.
How can I define the Combo -Box so she will show one example for each
value .


Use SELECT DISTINCT in your query. "Is Not Null" might be useful too.

Regards,
Keith.
www.keithwilby.com
Nov 13 '05 #2
"ego" <ki*****@hotmai l.com> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com...
Hello again my friends,

My question is :

In a Combo - Box , based on a table with duplicate values.
How can I define the Combo -Box so she will show one example for each
value .
For example :

Internet site name , Subject of the internet site
A Technical
B Technical
C General
D General
E Fun
F Fun
The combo box will show : Technical, General, Fun.

I tried to go to the Query behind the ComboBox at to do A Group By
action,
But because the ComboBox required two fields : The primary key and the
subject field ,
It didn't work.

Please help me,

Ego

Group By sounds like a good idea, but if the combobox really requires two
fields what should the matching entry be for 'Fun'? 'E' or 'F'?
If the combobox doesn't need two columns, then change the column count to
one and use the Group By solution.

Nov 13 '05 #3
"Keith" <ke*********@ba eAWAYWITHITsyst ems.com> wrote in message
news:42******** @glkas0286.gree nlnk.net...
"ego" <ki*****@hotmai l.com> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com...
Hello again my friends,

My question is :

In a Combo - Box , based on a table with duplicate values.
How can I define the Combo -Box so she will show one example for each
value .


Use SELECT DISTINCT in your query. "Is Not Null" might be useful too.

Sorry, just re-read your post and this won't work on the example you gave.
Nov 13 '05 #4
ego
Hi Keith,

It didn't work.

Ego

Nov 13 '05 #5
ego
Hi Justin,

The Combobox does need two fields.

Thanks,

Ego

Nov 13 '05 #6
ego
Hi Keith,

No Problem

Thank you for helping me

Thanks :)

Ego

Nov 13 '05 #7
"ego" <ki*****@hotmai l.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Hi Justin,

The Combobox does need two fields.

Thanks,

Ego

....so what should the matching entry be for 'Fun'? 'E', 'F' or don't you
care?
If you don't care, use the sql below:

SELECT First(SiteSubje ct) AS Subject, SiteName AS Site
FROM MyTable
GROUP BY SiteName

Alternatively, replace First with Last or Max or Min and see which one takes
your fancy.
Nov 13 '05 #8
ego
Hi Justin

I got a few error messages.

I will try to describe exactly what I am doing :

1. I have a Table named: TabInternetSite List

2. The Table has Three fields:
A. InternetSiteId (Primary Key)
B. Internet Address (Hyper Link).
C. Subject (Text)

3. I created a Form based on this table.

4. Than I add a ComboBox and chose option number 3:

"Find a record on my form based on the value I selected in my
ComboBox"

The Combobox is based on the Subject Field.

So I have Internet sites with the same subject .

My ComboBox is looking like this :

Map
Map
General
Technical
Software
Software

The Query behind the ComboBox is a combination of:

InternetSiteId Field and the Subject field.

If I will try to erase the InternetSiteId Field I will not see
anything in the ComboBox

Thanks,

Ego

Nov 13 '05 #9
"ego" <ki*****@hotmai l.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Hi Justin

I got a few error messages.

I will try to describe exactly what I am doing :

1. I have a Table named: TabInternetSite List

2. The Table has Three fields:
A. InternetSiteId (Primary Key)
B. Internet Address (Hyper Link).
C. Subject (Text)

3. I created a Form based on this table.

4. Than I add a ComboBox and chose option number 3:

"Find a record on my form based on the value I selected in my
ComboBox"

The Combobox is based on the Subject Field.

So I have Internet sites with the same subject .

My ComboBox is looking like this :

Map
Map
General
Technical
Software
Software

The Query behind the ComboBox is a combination of:

InternetSiteId Field and the Subject field.

If I will try to erase the InternetSiteId Field I will not see
anything in the ComboBox

Thanks,

Ego

You followed the wizard and selected "Find a record on my form based on the
value I selected in my ComboBox", but this doesn't sound like this is what
you wish it to do. This option is used where you have, say SiteID and
SiteName. You select the site you are looking for from the dropdown list
and you are taken to that record. It would not make sense to do that in
your case, because the dropdown list you are talking about will not identify
a site uniquely.
At a guess, you are trying is get a unique list of subjects so you can
select a subject for each type - and the best way to do this is to have a
separate table. However, as a lazy alternative you could create the list
based on existing types. Set the ControlSource to subject, the
RowSourceType to 'Table/Query', the RowSource to

SELECT First(SiteSubje ct) AS Subject, SiteName AS Site
FROM MyTable
GROUP BY SiteName
Set the column count to 1 and the column widths to 6cm (or whatever)
Nov 13 '05 #10

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

Similar topics

13
2799
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
8530
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 of doing it. I have a table with products, tblProducts, some of them are Active while others are Inactive. The form shows all the products purchased by a customer, both Active and Inactive in a ComboBox, cbProducts. My client wants to view all...
8
12106
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 combobox. What is the solution? Thank you in advance.
1
2499
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 DataTable("table"); testTable.Columns.Add("Col1", typeof(Int32)); testTable.Columns.Add("Col2", typeof(String)); testTable.Rows.Add(testTable.NewRow());
3
6835
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: http://msdn.microsoft.com/msdnmag/issues/03/08/DataGrids/default.aspx I have a problem when there are two DataGrid's on one form, and when I switch focus from one grid to the other. To be more precise, when I'm editing a combo box column in one grid, and then click in the combo column of...
2
6205
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 criteria that I wanted to meet, but nothing did: - No reliance on a separate library - No unmanaged code - Easy subclassing of System.Windows.Forms.Combobox (i.e. no custom control monstrosity) - No extra funky features that I didn't need
4
4620
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 bound to a table as a lookup, drawing values from another table to populate the available selections. This all worked fine in VB6. I have distilled the problem down to a simple form drawing data from the Northwind database for a representative...
6
2883
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 and the coresponding 'Id' from the lookup table is to be inserted into the field of the new record. I have two simple tables. "tblPerson" is the data table. The lookup
1
3374
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 altezza ad un valore diverso da 21. Forse, cambiando la dimensione del font, si potrebbe riuscire a cambiare anche l'impostazione dell'altezza... (MS farebbe comunque meglio ad introdurre per il ComboBox una proprietà AutoSize impostabile a "false"...
5
5916
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 CompanyID's. The second combobox will contain unique memberID's. Each of the tables that I have to search contain a CompanyID and a memberID field, and these fields are not unique in the respective tables. Like CompanyID, MemberID
0
9632
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
9471
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,...
1
10071
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
9925
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7478
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
6723
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();...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4036
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2867
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.