Sorting of Blank Date (1 Viewer)

Alejo

Member
Local time
Today, 16:45
Joined
Jun 14, 2021
Messages
78
Hi Good day to all,

i sorted the P_Date in descending (thru Query1) and provided the result correctly.
However, I prefer that the Blank row in RED (with default value of Date today on D_Data) should be on the top.

I tried the option MySort: IIF(IsNull([P_Date],999999,[P_Date]) but does not work.
Can you please help me to formulate my required output (attached is the sample databse)

Thank you


1682776377289.png
 

Attachments

  • Database1.3 - Blank item location.accdb
    424 KB · Views: 65

Josef P.

Well-known member
Local time
Today, 15:45
Joined
Feb 2, 2023
Messages
827
There is no record with an empty P_Date in your example file.

SQL:
SELECT ...
FROM Table1
ORDER BY Nz([P_Date],#12/31/2999#) DESC;
 

Alejo

Member
Local time
Today, 16:45
Joined
Jun 14, 2021
Messages
78
There is no record with an empty P_Date in your example file.

SQL:
SELECT ...
FROM Table1
ORDER BY Nz([P_Date],#12/31/2999#) DESC;
Hi,
I tried the suggestion but it doest work, still showing the blank page at the bottom (i meant blank page, a new row to insert new information).

SELECT Table1.Customer, Table1.Product, Table1.D_Date, Table1.P_Date
FROM Table1
ORDER BY Nz([P_Date],#12/31/2999#) DESC;


May I request to please directly put the code to the attached database?
 

Gasman

Enthusiastic Amateur
Local time
Today, 14:45
Joined
Sep 21, 2011
Messages
14,311
Are you sure that is Null and not a ZLS?
DB to late a version for me to look at. :(

If that is a new record and the default for D_Date is Date, then there is no value?
 

Alejo

Member
Local time
Today, 16:45
Joined
Jun 14, 2021
Messages
78
This is the line for a new record.
Yes Josef, this is the line for new record.

I just make a default value for D_Date, since the new record will always use TODAY date for D_Date
 

CJ_London

Super Moderator
Staff member
Local time
Today, 14:45
Joined
Feb 19, 2013
Messages
16,617
New records always appear at the bottom. No way round it from a display perspective. What you can do is have a subform in the header section to capture the new record data. On save, requery the main form
 

Alejo

Member
Local time
Today, 16:45
Joined
Jun 14, 2021
Messages
78
New records always appear at the bottom. No way round it from a display perspective. What you can do is have a subform in the header section to capture the new record data. On save, requery the main form
Thanks CJ for the info.

I still leave it unresolved for future references.
 

GPGeorge

Grover Park George
Local time
Today, 06:45
Joined
Nov 25, 2004
Messages
1,873
Thanks CJ for the info.

I still leave it unresolved for future references.
I think the only reason you see a date there in the D_Date field for the new record would be that it's a default value waiting to be used IF a record is created.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 09:45
Joined
May 21, 2018
Messages
8,529
I still leave it unresolved for future references.
FYI, there is a difference between unresolved and impossible.
It is impossible in datasheet or continuous form view to have a new record appear at the top of the list. No amount of code or workarounds exist to change that.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 14:45
Joined
Feb 19, 2013
Messages
16,617
see attached for example as I suggested

It works, but no points for presentation or functionality - that is up to you

Note that as a rule it is not a good idea to have forms which show all records - a few hundred is fine but you will start to see slower performance when the numbers get higher
 

Attachments

  • Database1.3 - Blank item location.accdb
    452 KB · Views: 69

Alejo

Member
Local time
Today, 16:45
Joined
Jun 14, 2021
Messages
78
Thank you all for your response, appreciated.
 

Users who are viewing this thread

Top Bottom