A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Sorting empty fields



 
 
Thread Tools Display Modes
  #1  
Old April 20th, 2010, 02:32 AM posted to microsoft.public.access.forms
Hank
external usenet poster
 
Posts: 121
Default Sorting empty fields

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.
Ads
  #2  
Old April 20th, 2010, 03:35 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Sorting empty fields

On Mon, 19 Apr 2010 18:32:01 -0700, Hank
wrote:

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#)
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright 2004-2020 OfficeFrustration.
The comments are property of their posters.