A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Combo-Box Duplicates



 
 
Thread Tools Display Modes
  #1  
Old December 18th, 2006, 09:40 PM posted to microsoft.public.access.forms
JonBake32
external usenet poster
 
Posts: 1
Default Combo-Box Duplicates

I have referenced a Combo-Box in my form to a table and my problem is a
larger version of this:

Lets say I have three names I will ever enter in a combo box: Apples,
Oranges, and Bananas. How do I format the drop-down so that it ONLY displays
the three names:
Apples
Oranges
Bananas

Instead of displaying all of the duplicates that are in that field such as:
Apples
Apples
Apples
Oranges
Oranges
Bananas
Bananas


Thank you.

  #2  
Old December 18th, 2006, 09:51 PM posted to microsoft.public.access.forms
fredg
external usenet poster
 
Posts: 4,386
Default Combo-Box Duplicates

On Mon, 18 Dec 2006 12:40:00 -0800, JonBake32 wrote:

I have referenced a Combo-Box in my form to a table and my problem is a
larger version of this:

Lets say I have three names I will ever enter in a combo box: Apples,
Oranges, and Bananas. How do I format the drop-down so that it ONLY displays
the three names:
Apples
Oranges
Bananas

Instead of displaying all of the duplicates that are in that field such as:
Apples
Apples
Apples
Oranges
Oranges
Bananas
Bananas

Thank you.


Make the rowsource of the combo box a Distinct query, i.e.

Select Distinct TableName.FieldName From TableName Order by
[FieldName];

Change the table and field names as needed.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #3  
Old December 20th, 2006, 10:56 AM posted to microsoft.public.access.forms
Minnie M
external usenet poster
 
Posts: 27
Default Combo-Box Duplicates

Hi Fred, I tried this and received an error message saying ‘Syntax Error
(operator missing)’, so I inserted square brackets around each instance of
TableName and FieldName, and it works!

I’d now like to make the list display in alphabetical order, can I do that?


"fredg" wrote:

On Mon, 18 Dec 2006 12:40:00 -0800, JonBake32 wrote:

I have referenced a Combo-Box in my form to a table and my problem is a
larger version of this:

Lets say I have three names I will ever enter in a combo box: Apples,
Oranges, and Bananas. How do I format the drop-down so that it ONLY displays
the three names:
Apples
Oranges
Bananas

Instead of displaying all of the duplicates that are in that field such as:
Apples
Apples
Apples
Oranges
Oranges
Bananas
Bananas

Thank you.


Make the rowsource of the combo box a Distinct query, i.e.

Select Distinct TableName.FieldName From TableName Order by
[FieldName];

Change the table and field names as needed.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

  #4  
Old December 20th, 2006, 11:25 AM posted to microsoft.public.access.forms
Minnie M
external usenet poster
 
Posts: 27
Default Combo-Box Duplicates

Oops, sorry Fred, just noticed that it does display alphabetically, must have
had a senior moment there. Thanks for the post, it really helped me.

"Minnie M" wrote:

Hi Fred, I tried this and received an error message saying ‘Syntax Error
(operator missing)’, so I inserted square brackets around each instance of
TableName and FieldName, and it works!

I’d now like to make the list display in alphabetical order, can I do that?


"fredg" wrote:

On Mon, 18 Dec 2006 12:40:00 -0800, JonBake32 wrote:

I have referenced a Combo-Box in my form to a table and my problem is a
larger version of this:

Lets say I have three names I will ever enter in a combo box: Apples,
Oranges, and Bananas. How do I format the drop-down so that it ONLY displays
the three names:
Apples
Oranges
Bananas

Instead of displaying all of the duplicates that are in that field such as:
Apples
Apples
Apples
Oranges
Oranges
Bananas
Bananas

Thank you.


Make the rowsource of the combo box a Distinct query, i.e.

Select Distinct TableName.FieldName From TableName Order by
[FieldName];

Change the table and field names as needed.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.