# How get week number in a text box on a report

On a report I have 52 text boxes arranged vertically.  In the first box I want the value of the textbox to be the 1st week of the year's number (1).  In the next textbox I want the 2nd week of the year's number (2). So the end result will be:

1
2
3
4
5
6
etc.

I could be using labels to designate the value but the reason I need a calculated value is because I'm going to use that value in a formula in another textbox to the right of each week's number textbox.

Make sense?  What is the control source I need to enter to get the week number?

I tried = DatePart(“ww”,Date(#01/01/2012#)) but obviously that isn't working.
mbizup

membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Your syntax will also work with a slight modification:

``= DatePart("ww",#01/01/2012#)``

(You were mis-using the Date function - which simply returns todays date)
I don't understand why you can't assign number without any conversions?
=1, =2 etc.
If it is detail part of your report, you can create table with numbers from one to 52 and use it in your report.
Steve,

I'm glad that helped out - but I'm still not clear what you are trying to accomplish.

If those values really need to be set dynamically, my own approach would have been to look at them simply as "52 consecutive numbers" rather than anything date-related.

I'd name the textboxes (or labels) in a sequential manner like txtWk01, txtWk02, etc.  They could then be populated with code in the Open Event of your form like this:

``````Private Sub Form_Open(Cancel as integer)
For i = 1 to 52
Me.Controls("txtWk" & format(i,"00")) = i
next
End Sub``````
I need a calculated value is because I'm going to use that value in a formula in another textbox to the right of each week's number textbox.
This doesn't really make sense.  You are using calculated values just to return the numbers 1 through 52 to use in another calculated textbox?