P
PatK
I have a table that I need to insert the week of the year into a field, ie, I
need to insert YYYY-WW (text) format, generated from a field I call
Create_date (date row was created in the table). My week starts on Sunday.
So, for 2008, my week 1 would be Jan 6 2008, through Jan 12 2008.
Conversely, week "53" of 2007 would be from Dec 30 2007 to Jan 5 2008. My
table has multiple years of data in it, so what I am needing needs to work
for, basically, any year, starting with 2006.
I have found that using simple functions works "some of the time" but not
all, specifically for the last week and first week of the year. If every year
started on Sunday, I could generate the field pretty simply, but alas, this
is not the case.
For example, Access considers Jan 1 2008 to Jan 8 2008 as week 1, and this
will not work for me, as my first week must begin on the first Sunday, and go
forward from there.
My plan is to go in and "fix" old/historical data, one time (adding this new
field/column), and going forward, load the correct week into the table, based
upon a calculation (probably a function) when I load the data, using VBA.
I was wondering if anyone had run into this, and already addressed it, else,
I will just have to go in and figure out the code. Thanks for any help!
PatK
need to insert YYYY-WW (text) format, generated from a field I call
Create_date (date row was created in the table). My week starts on Sunday.
So, for 2008, my week 1 would be Jan 6 2008, through Jan 12 2008.
Conversely, week "53" of 2007 would be from Dec 30 2007 to Jan 5 2008. My
table has multiple years of data in it, so what I am needing needs to work
for, basically, any year, starting with 2006.
I have found that using simple functions works "some of the time" but not
all, specifically for the last week and first week of the year. If every year
started on Sunday, I could generate the field pretty simply, but alas, this
is not the case.
For example, Access considers Jan 1 2008 to Jan 8 2008 as week 1, and this
will not work for me, as my first week must begin on the first Sunday, and go
forward from there.
My plan is to go in and "fix" old/historical data, one time (adding this new
field/column), and going forward, load the correct week into the table, based
upon a calculation (probably a function) when I load the data, using VBA.
I was wondering if anyone had run into this, and already addressed it, else,
I will just have to go in and figure out the code. Thanks for any help!
PatK