Sorting with null / blank fields last

  • Thread starter Thread starter justme
  • Start date Start date
J

justme

How can I have a query sort a field with dates in such a manner that blank /
null entries are last?

TIA for the help!

JustMe
 
You could create a calculated field such as the following and use it as your
primary or first sort:

IIf(IsNull([MyDateField]),9999,1)

Then make your Date field the second sort.

hth,
 
Assuming a field named "MyField", type this into the Field row of your
query:
IsNull([MyField])
and choose Descending in the Sorting row.
Then add MyField in a column to the *right* of that.

How it works:
The calculated field returns True if the field is null, else False.
In Access, True is -1, and False is zero.
Sorting Descending sorts the zero (False) before -1 (True.
 

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

Similar Threads

#error - Blank 3
Sort with null / blank entries last 2
Tallying Null fields 6
Blank Fields in NOT Null Query Criteria 5
Returning null values 4
Muliple Critera 1
Null Date Question 1
Making null 3

Back
Top