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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert Week/Yr to Month/1/Yr

Status
Not open for further replies.

peryan77

Programmer
May 7, 2004
41
US
I need help converting Week/Yr to Month/1/Yr. I have the week/yr in a table.

Thanks.
 
The week / year data is week number, ie 1, 2, 3.... for say 2003?

Also, is the week stored as 01,02,03 or just 1/,2/,3/?

Try something like this:

=format (datevalue ("01/01/" & right([yourfield], 4) + (left ([yourfield], 2) * 7), "MM/01/YYYY")

This assumes a format like this: 01/2003.

ChaZ


Ascii dumb question, get a dumb Ansi
 
The week and the year values are stored in seperate tables.
 
I tried it your way my combinging values into one field, and I used your expression and it gives me expression contains wrong # of arguments.
 
Post your formula as you typed it. Probably I put a ) in the wrong place, but I don't see it.

ChaZ

Ascii dumb question, get a dumb Ansi
 
I just copied and pasted your function, and the ) seems to be ok.

Anyway,

I came up with this b/c I decided I wanted the first day of the week. I know I could use first day of week function instead of -7 but it gives same result. My one weakness is manipulating dates. Never had to do it much.


DateAdd("d",(([DIAD_Battery_Info]![Week]*7)-7),FormatDateTime("1/1/ " & [DIAD_Battery_Info]![Yr]))
 
How will you handle the scenario where the specified week starts in one month and ends in the next? For example:

Week 18 of 2004 starts on 25-Apr-04 and ends 1-May-04.

Just wondering,

Bob
 
Access seems to be pulling the month when the first day of the week falls. Ok by me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top