PDA

View Full Version : Populating a Menu Field For A Form


Thatguy2001au
10-13-2002, 03:45 PM
Hi

I hope someone can help me.

I need to populate a menu on a form with data from a sql server database. It should show a list of categories. The problem is, that the items in the menu field are being repeated. How do i make it so they do not repeat?

whammy
10-13-2002, 05:16 PM
SQL Server syntax (where "categoryname" is the field you don't want to repeat):

SELECT DISTINCT(categoryname) FROM tablename ORDER BY categoryname

:)

If you want a count of categories, you can do:

SELECT COUNT(DISTINCT categoryname) as mycount FROM tablename

If you were using Access, the syntax would be a bit different for the latter query however.

Thatguy2001au
10-13-2002, 05:29 PM
Thanks Whammy

I used the 'DISTINCT' part in my query and it worked. Thanks.

whammy
10-13-2002, 05:31 PM
:)