Sort Ascending

  • Thread starter ladybug via AccessMonster.com
  • Start date
L

ladybug via AccessMonster.com

I am trying to sort a list of dates on a continuous form. I want it
ascending. However, there are some entries that do not have any dates. I
want these entries to be at the bottom.
Currently, these entries without dates are at the top because of the
ascending sort.

Any ideas?
 
D

Douglas J. Steele

Easiest solution would be to add a computed field to the query, and sort on
that computed field.

Assuming that the records with no date actually have a Null value stored for
the date, the computed field should be

Nz([MyDateField], #12/31/9999#)
 
L

ladybug via AccessMonster.com

I tried this and it worked. However, users will eventually be able to update
this field with the correct date. With this code users cannot update the
field. You cannot edit it.
Easiest solution would be to add a computed field to the query, and sort on
that computed field.

Assuming that the records with no date actually have a Null value stored for
the date, the computed field should be

Nz([MyDateField], #12/31/9999#)
I am trying to sort a list of dates on a continuous form. I want it
ascending. However, there are some entries that do not have any dates. I
[quoted text clipped - 3 lines]
Any ideas?
 
L

ladybug via AccessMonster.com

I'm sorry I do not understand. How can I sort by ISNull? When sorting I can
only make an ascending or descending selection.
SORT BY ISNULL (mydate) DESCENDING, Mydate ....
I am trying to sort a list of dates on a continuous form. I want it
ascending. However, there are some entries that do not have any dates. I
[quoted text clipped - 3 lines]
Any ideas?
 
J

John Spencer

In the query grid, insert a calculated field (before your current date
field)

Field: IsNull([YourDateField])
Sort: Descending


ladybug via AccessMonster.com said:
I'm sorry I do not understand. How can I sort by ISNull? When sorting I
can
only make an ascending or descending selection.
SORT BY ISNULL (mydate) DESCENDING, Mydate ....
I am trying to sort a list of dates on a continuous form. I want it
ascending. However, there are some entries that do not have any dates.
I
[quoted text clipped - 3 lines]
Any ideas?
 
D

Douglas J. Steele

I said to sort on that field, not bind it to a control on the form. You'd
still have MyDateField in the query, and bind the text box to that field.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


ladybug via AccessMonster.com said:
I tried this and it worked. However, users will eventually be able to
update
this field with the correct date. With this code users cannot update the
field. You cannot edit it.
Easiest solution would be to add a computed field to the query, and sort
on
that computed field.

Assuming that the records with no date actually have a Null value stored
for
the date, the computed field should be

Nz([MyDateField], #12/31/9999#)
I am trying to sort a list of dates on a continuous form. I want it
ascending. However, there are some entries that do not have any dates.
I
[quoted text clipped - 3 lines]
Any ideas?
 
L

ladybug via AccessMonster.com

Perfect!!!!! Thank you so much!!!

John said:
In the query grid, insert a calculated field (before your current date
field)

Field: IsNull([YourDateField])
Sort: Descending
I'm sorry I do not understand. How can I sort by ISNull? When sorting I
can
[quoted text clipped - 8 lines]
 
D

David F Cox

FWIW Actual tested working code:-

SELECT Table1.ID, Table1.name1
FROM Table1
ORDER BY IsNull(name1) DESC , Table1.name1;

I just entered that as SQL, just like that, no field specified in the QBE
grid

OK, so go figure ...


ladybug via AccessMonster.com said:
I'm sorry I do not understand. How can I sort by ISNull? When sorting I
can
only make an ascending or descending selection.
SORT BY ISNULL (mydate) DESCENDING, Mydate ....
I am trying to sort a list of dates on a continuous form. I want it
ascending. However, there are some entries that do not have any dates.
I
[quoted text clipped - 3 lines]
Any ideas?
 
L

ladybug via AccessMonster.com

So now my users would like an additional sort to what we have already created.
Now they want to sort all the tasks that do not have a date to be sorted how
they were entered. Currently we have it set to Ascending which puts the
fields in alphabetical order. If I change it to not sorted then the list is
reversed from how it was entered. Any way I can make this happen?

John said:
In the query grid, insert a calculated field (before your current date
field)

Field: IsNull([YourDateField])
Sort: Descending
I'm sorry I do not understand. How can I sort by ISNull? When sorting I
can
[quoted text clipped - 8 lines]
 

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