MS Access 'Weekday' function

Anonymous
2022-08-15T16:16:24+00:00

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?

Microsoft 365 and Office | Access | For business | Windows

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.

0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. ScottGem 68,780 Reputation points Volunteer Moderator
    2022-08-15T16:22:28+00:00

    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])

    0 comments No comments
  2. Anonymous
    2022-08-15T17:44:26+00:00

    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.

    0 comments No comments
  3. Anonymous
    2022-08-16T09:36:01+00:00

    You haven't done anything wrong; both the syntax and the expression are totally valid.

    So:

    • Check menu Tools, References for any reference marked MISSING. If any, resolve that.
    • Run a Compact & Repair
    • Force an update of Access
    0 comments No comments