Jennifer Gross
jengross at gte.net
Fri Mar 6 15:13:31 CST 2009
Brilliant. I will see if turning the logic into an Access function does the trick. Jennifer -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David McAfee Sent: Friday, March 06, 2009 1:07 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Figuring the date I got this to work in SQL server, maybe someone can do something similar in Access to help you out. Another thing would be to make a function. SET DATEFIRST 1 DECLARE @Yr AS INT, @WkNo AS INT SELECT @Yr = 2009, @WkNo = 10 --SELECT DATEADD(week, @WkNo, ('1/1/' + CAST(@Yr AS VARCHAR(4)))) --Gives us the date 10 weeks after jan 1st SELECT DATEADD(DAY,1-DATEPART(dw,DATEADD(week, 10, ('1/1/' + CAST(@Yr AS VARCHAR(4))))),DATEADD(week, @WkNo, ('1/1/' + CAST(@Yr AS VARCHAR(4))))) On Fri, Mar 6, 2009 at 12:50 PM, Gary Kjos <garykjos at gmail.com> wrote: > If it's for a finite group of years I would use a date table. It's the > data warehouse way for things like that and I work in the data > warehouse group, hence my leaning towards that. You pre-load the date > table and your good. Until the pre-loaded dates pass by of course. > > GK > > On Fri, Mar 6, 2009 at 2:38 PM, Jennifer Gross <jengross at gte.net> > wrote: > > Okay, I have answers to my questions - they define Week 1 as the > > first full week of the year and the week is defined as Monday to > > Sunday. Any thoughts on how to get that Monday date when I know the > > year and the week #? > > > > Jennifer > > > > -----Original Message----- > > From: accessd-bounces at databaseadvisors.com > > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jennifer > > Gross > > Sent: Friday, March 06, 2009 12:34 PM > > To: AccessD List > > Subject: [AccessD] Figuring the date > > > > > > Hey Everyone, > > > > I have two pieces of information - the year and the week # within > > the year, for instance 2008 13 is the 13th week in 2008. I have > > questions out to the client about how they define the week (Sun-Sat, > > Mon-Sun) and how the first week of the year is defined - week that > > January 1 falls in or first full week of the year. Anyway - what I > > need to do is create a function, unless one already exists, when fed > > these two pieces of information returns the Monday date (short date > > format) for that week. > > > > Any help is appreciated. > > > > Jennifer > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > No virus found in this incoming message. > > Checked by AVG - www.avg.com > > Version: 8.0.237 / Virus Database: 270.11.8/1986 - Release Date: > > 03/05/09 19:32:00 > > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > > > -- > Gary Kjos > garykjos at gmail.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.0.237 / Virus Database: 270.11.8/1986 - Release Date: 03/05/09 19:32:00