Date is a reserved word in Access and shouldn't be used as an object name. That may be the cause od your issue.
And alternative would be to use DatePart("w",[datefield])
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
My Access 2010 textbook, Access Help and the web all say I can use the 'Weekday' function in Access queries. I have a column called 'Date' and have tried to build a query that shows the weekday for that column. Whether I use 'Expression' or 'Group By' I'm given an error. If I use SQL view I still get the same error. What have I done wrong?
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Date is a reserved word in Access and shouldn't be used as an object name. That may be the cause od your issue.
And alternative would be to use DatePart("w",[datefield])
Do you want to show the weekday as a number or the name of the day of the week? If the latter use the Format function. You can see how the functions differ by entering some expressions in the immediate window:
? Date()
15/08/2022
? Weekday(Date())
2
? DatePart("w",Date())
2
? Format(Date(),"ddd")
Mon
? Format(Date(),"dddd")
Monday
Another possible reason for the error is that you have a missing or broken reference. Check out Tools|References on the VBA menu bar.
You haven't done anything wrong; both the syntax and the expression are totally valid.
So: