Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Week No in a query

Status
Not open for further replies.

Djbell

IS-IT--Management
Apr 22, 2002
175
GB
Hi All

I have a query that has a date field, I would like to add another Field called Week No. Week number would then automatically assign a week number to the date..

So for example.

If Week No 1 starts on 02/01/2006

Then the following dates should be labelled with the following Week No's

13/03/2006 Week 11
04/04/2006 Week 14
15/06/2006 Week 24

Any help is appreciated.

Regards

Douglas Bell
 
You could try the DateDiff function:

Code:
SELECT  X.Date, 'Week ' & ( DateDiff('ww',  datevalue('02/01/06'), X.Date) + 1) AS WeekNo 
FROM X
 
Have you tried this ?
DatePart("ww", [date field])

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top