That would be my guess, but it's just a guess since you provide no clue as to the values returned by what look like two functions (another guess). If there is a way to debug.print the value of DATEFROMPARTS when a given year is passed to it, I'd do that to confirm. I could be all wet - maybe those aren't UDF's but are part of ODBC syntax. I presume you're using this against a non-Access db since Access doesn't support CASE WHEN and you say it worked in the past.
- "doesn't work" is no help.Error #s/text do. State what's happening.
- Use code tags for code/sql; show where errors occur
Make all suggested changes in copies of your database or to its objects