DatePart Expression

T

Tom Cunningham

Hello,

I need help with a DataPart expression within a query (Access 2007). DatePart (interval,date, [firstdayofweek],[firstweekofyear])

I?m currently using the DatePart function to group student scores by week as follows, Week: DatePart("ww",[Date]) and this works but, the default first day of the week is Sunday and the last is Saturday. I would like to set the first day of the week to be Thursday and the last Wednesday and when I try to adjust firstdayofweek I?m not able to get it to work.

I would really appreciate it if someone could help me with this.

Thanks,
Tom
 
J

John W. Vinson

Hello,

I need help with a DataPart expression within a query (Access 2007). DatePart (interval,date, [firstdayofweek],[firstweekofyear])

I?m currently using the DatePart function to group student scores by week as follows, Week: DatePart("ww",[Date]) and this works but, the default first day of the week is Sunday and the last is Saturday. I would like to set the first day of the week to be Thursday and the last Wednesday and when I try to adjust firstdayofweek I?m not able to get it to work.

I would really appreciate it if someone could help me with this.

Thanks,
Tom

Try

DatePart("ww", [Date], vbThursday)

if you're doing it in VBA code, or

DatePart("ww", [Date], 5)

in a Query. vbThursday is a builtin VBA constant equal to 5, but it's only
available in VBA, not in queries.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top