Sorting

R

rml

I have a query that I would like to sort by part number (assending) first and
any records without part numbers to be after the part numbers. I have
serveral records that do not have part numbers. If I sort my query by part
numbers (assending) I get all records without part numbers first. No good.
If I sort my query by part number (desending) I get all records with part
numbers first but desending. Also, not what I want.

Thanks.
 
D

Douglas J. Steele

Do the records without part numbers have Null or spaces for the value?

In either case, add a computed field to your query along the lines of
SortField: IIf(IsNull([PartNumber]), 0, 1) or SortField:
IIf(Len([PartNumber]) = 0, 0, 1) or (to combine both possibilities!)
SortField: IIf(Len([PartNumber] & "") = 0, 0, 1)

Put SortField ahead of PartNumber in the sort order.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top