Hi,
I need a query criteria which is between two dates.
The first is fixed, example #01/07/2024# and the other is TODAY-1
Today is the 27/8/2024 so I need the values to be between 01/07/2024 and 26/8/2024
Thanks in advanced to any reply![]()
Hi,
I need a query criteria which is between two dates.
The first is fixed, example #01/07/2024# and the other is TODAY-1
Today is the 27/8/2024 so I need the values to be between 01/07/2024 and 26/8/2024
Thanks in advanced to any reply![]()
Use Date - 1 with Between
If you are going to hardcode dates then they need to be in mm/dd/yyyy or yyyy-mm-dd format.
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
In sql 01/07/2024 is interpreted as 7th Jan
you need to format your date as mm/dd/yyyy or the sql standard of yyyy-mm-dd
31/8/2024 is ok because there are not 31 months in a year
Or avoid any possible date format issues, and use 'BETWEEN DateSerial(2024,7,1) AND Date()-1'
To filter values between a fixed date and TODAY-1, use this SQL query:sqlCopy codeSELECT *FROM your_tableWHERE date_column BETWEEN '2024-07-01' AND DATEADD(day, -1, GETDATE());
I seriously doubt that will work?
In fact I tested it to be sure and got data type mismatch, which I would have expected.
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
That is T-SQL syntax, not access sql syntax