Sort in an IIf statement

H

Huber57

To all:

I am using Access 2003.

I have a IIf statement in a query that looks like this:

Owner: (IIf([LLCName]="Smith Properties","SP#" &
(IIf([LLCNumber]>0,[LLCNumber],"XX")),"SD"))

The LLCNumber field is stored as a number.
The LLCName is stored as text.

It returns things like:
SP#101
SP#89
SP#45
SD
SP#XX
Right now, it is returning them with all of the 100s before the 90's as it
recognizes 1 is before 9, etc.

I would like to sort these by the LLCNumber. Is that possible?

Thanks in advance for your help!
 
M

Marshall Barton

Huber57 said:
That works great in my query. Thanks for that.

But, when the report it is bound to runs, it still show items out of order.


Not so fast. If you are using the query as the record
source for a report, then the query's sorting will be
irrelevant (and a waste of time) in all but very simple
reports. You should use the expression (or the calculated
field) in the report's Sorting and Grouping (View menu).
 
Top