Sorting empty fields

  • Thread starter Thread starter Hank
  • Start date Start date
H

Hank

My form has the following fields: ID, DueDate, DatePaid,HowPaid,Check#,
AmtPaid, FeePaid, Gift, PastDue, Notes.

A DatePaid entry can be made for a Gift or Fee leaving the duedate field
empty. I would like to sort by the due date with the empty fields sorted by
datepaid. Right now the empty fields are on top of the sorted list. I do
not want to sort by datepaid when duedate field is not empty.
 
My form has the following fields: ID, DueDate, DatePaid,HowPaid,Check#,
AmtPaid, FeePaid, Gift, PastDue, Notes.

A DatePaid entry can be made for a Gift or Fee leaving the duedate field
empty. I would like to sort by the due date with the empty fields sorted by
datepaid. Right now the empty fields are on top of the sorted list. I do
not want to sort by datepaid when duedate field is not empty.

Try putting a calculated field in the query:

SortBy: NZ(DueDate, DatePaid)

and sort by this field. It'll sort by DueDate if there is one, and only if it
is NULL by DatePaid. Of course if both fields are null the result will be null
and it will sort at the top; to sort these at the bottom you could use

NZ(NZ(DueDate, DatePaid), #12/31/9999#)
 

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

IIF statement 6
IIF statement failing 3
Past Due Expression 1
Filter based on date range and a field value 6
Create query but need to change tables 2
Query sorting help 3
Calucation in query 2
Date + 30 days 2

Back
Top