Solved Build A Query "Like Current Year"

pooldead

Registered User.
Local time
Today, 04:06
Joined
Sep 4, 2019
Messages
136
Right off the top, I'd like to mention that I am trying to build this query in Query Design and not VBA, so that it can be used in a report chart.

I have a field with the date stored as yyyy-mm (2020-05). I'm trying to build a SELECT query that will pull data where the field has the current year. What I currently have is:
Code:
SELECT Field1
FROM Table1
WHERE Field1 Like "*(Year(Now()))*";
I don't get any errors with this, but the search pulls up empty. Can someone please assist?
 
Hi. What is the data type of Field1?
 
Short text - but I tried with it as a number and Date/Time (formatted) as well and no luck
 
Last edited:
Yup, the literal value pulls the records.
So, that tells me there's something wrong with your expression to pull the current year. Try this one next:

WHERE Field1 Like "*" & Year(Date()) & "*"
 

Users who are viewing this thread

Back
Top Bottom