date in report (1 Viewer)

afankhan

New member
Local time
Today, 22:15
Joined
Mar 28, 2018
Messages
3
I am trying to create a database in MS Access, I have created some reports, I have made some filters in a report where if I click one record it opens new report with some specific record, all is working perfectly but when I click date to open all records of that particular date, it works but coverts UK date to US date and opens wrongs dates like if I click 05/01/2018 (5th Jan 2018) it opens records for 01/05/2018 (1st may 2018), please help me to solve it. thanking you in advance
 

CJ_London

Super Moderator
Staff member
Local time
Today, 19:15
Joined
Feb 19, 2013
Messages
16,605
or the date needs to be unambiguous


so 27/11/2018 will work because sql knows there are only 12 months in the year and will swap the day and month fields around - which is why it appears to work sometimes

similarly a date of 5 Jan 2018 is unambiguous

another format recently suggested in another thread that seems to work - and 'makes sense' in the UK is yyyy mm dd
 

isladogs

MVP / VIP
Local time
Today, 19:15
Joined
Jan 14, 2017
Messages
18,211
For an interesting example of how Access can misinterpret ambiguous dates, try typing this into the VBE immediate window
Code:
?#28/2/29#

The result you would expect in the UK is 28/02/1929 or possibly 28/08/2029
The actual result given is 29/02/2028

BTW: ?#2/28/29# and ?#29/2/28# both give the same output

However ?#2/29/28# gives 29/02/2028 which is correct
 

Users who are viewing this thread

Top Bottom