Hi. There are some problems with your SQL, in that you've mixed up what you are trying to select with how you want to select it.
You want to select all rows in which the [Actual Date] field matches the current day and month. Try:
- SELECT [Actual Date] AS [Past Date]
-
FROM [Gas Data]
-
WHERE Month([Actual Date]) = Month(Date())
-
AND Day ([Actual Date]) = Day(Date())
-
ORDER BY [Actual Date] DESC;
Be aware if you use FORMAT that it returns text values, and you cannot order dates formatted as text unless you return them with the year reversed: yyyy/mm/dd for example. There is, however, no need to use format for what you want to do.
-Stewart
PS if there are no rows in table [Gas Data] with [Actual Dates] matching the current day and month then the query will not return any rows at all. Depending on what you do with this query for your report you may not find it of practical use in itself.