PC Review


Reply
Thread Tools Rate Thread

Advanced filter/sort in MS access

 
 
=?Utf-8?B?RGViIFRlY2g=?=
Guest
Posts: n/a
 
      4th Jun 2006
How do you sort a text field alphabetically by the first letter of the field
while ignoring the numbers.
For example, I would like my records to be sorted as follows:
A
B
45-C
G
123-P
T
Thanks for your help
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      4th Jun 2006
One way would be to write a function that returns the first letter in the
field, add a computed field to your query that returns the value of that
function and then sort on that computed field.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Deb Tech" <Deb (E-Mail Removed)> wrote in message
news:4D13DD24-8511-4151-B9A3-(E-Mail Removed)...
> How do you sort a text field alphabetically by the first letter of the
> field
> while ignoring the numbers.
> For example, I would like my records to be sorted as follows:
> A
> B
> 45-C
> G
> 123-P
> T
> Thanks for your help



 
Reply With Quote
 
fredg
Guest
Posts: n/a
 
      4th Jun 2006
On Sun, 4 Jun 2006 08:53:01 -0700, Deb Tech wrote:

> How do you sort a text field alphabetically by the first letter of the field
> while ignoring the numbers.
> For example, I would like my records to be sorted as follows:
> A
> B
> 45-C
> G
> 123-P
> T
> Thanks for your help


The Text is always preceded by a hyphen?
Add a new column to your query.

SortThis:IIf(InStr([FieldName],"-")>0, Mid([FieldName],
InStr([FieldName], "-") +1),[FieldName])

Sort on this column.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with advanced filter sort window Julia B Microsoft Access VBA Modules 0 30th Nov 2009 12:19 PM
How prevent Advanced Filter Sort from self-clearing on Form? MHenry Microsoft Access Forms 0 30th Jun 2006 11:54 PM
Advanced filter to sort on secondary column =?Utf-8?B?Umlja0I=?= Microsoft Access 1 22nd Apr 2006 03:29 AM
Advanced Filter/Sort within VBA code =?Utf-8?B?UGF1bCBELiBTaW1vbg==?= Microsoft Access VBA Modules 1 19th Apr 2004 10:24 PM
Advanced Filter/Sort Question Jfs Microsoft Access 1 31st Dec 2003 01:54 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:23 AM.