By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,438 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

ComboBox

P: n/a
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
Share this Question
Share on Google+
10 Replies


P: n/a
"ego" <ki*****@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.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

P: n/a
"ego" <ki*****@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.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

P: n/a
"Keith" <ke*********@baeAWAYWITHITsystems.com> wrote in message
news:42********@glkas0286.greenlnk.net...
"ego" <ki*****@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.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

P: n/a
ego
Hi Keith,

It didn't work.

Ego

Nov 13 '05 #5

P: n/a
ego
Hi Justin,

The Combobox does need two fields.

Thanks,

Ego

Nov 13 '05 #6

P: n/a
ego
Hi Keith,

No Problem

Thank you for helping me

Thanks :)

Ego

Nov 13 '05 #7

P: n/a
"ego" <ki*****@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.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(SiteSubject) 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

P: n/a
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: TabInternetSiteList

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

P: n/a
"ego" <ki*****@hotmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.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: TabInternetSiteList

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(SiteSubject) 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

P: n/a
ego
Hi Justin

I had mange to fix the problem.

Thank you very much for your help.

Thanks!!!!!

Ego.

Nov 13 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.