View Full Version : How to sort a table


Davighi
09-27-2004, 04:54 AM
Hi I have a database of over 100,000 records with 20+ feilds

One of the feilds is a text feild (250) I need to sort this feild so that it displays the records by length, so I can reduce the longest entries to say 80 characters.

The editing needs to be done by hand rather than chopping entries at the 80 character mark.

Is there a way of sorting the table like this easily, do you use a query or what?

I am a near beginner and am using Access 2002

Bat17
09-27-2004, 05:37 AM
Yes, use a query, you can then use a function to find the field lenth and sort on that
FieldLen:Len([my Field])

HTH

Peter

Davighi
09-27-2004, 06:07 AM
Sorry if it is a dumb question but how do I add it to this sql query

SELECT adverts.title, adverts.name
FROM adverts;

title is the field I need sorting by length

Mile-O
09-27-2004, 06:17 AM
SELECT adverts.title, adverts.name
FROM adverts
ORDER BY Len(adverts.name) DESC;

Incidentally, Name is a reserved word in Access and should not be used as a field name.

Davighi
09-27-2004, 06:29 AM
Thanks Bat17 and SJ McAbney for the fast response

I have changed the 'name' field and it works like a dream