Can You Query By Week Number Rather Than Between Dates
May 17, 2005
Is it possible to query using the week number in the year as criteria. For example instead of putting 13/05/05 to 20/05/05 can we use week 12 - the idea is to save on keying info in each time.
The 1st/2nd Jan of this year were treated by most people as still being week 53 of 2004, and week commencing 3rd January being week 1 of 2005. In VB I have a formula to do this:
I analyse things by the date they are ordered by the office.
The date gets put into a spreadsheet and i import this into access for the querying.
I need to summarise it by weeknumber and year.
I use the following queries:
To get the week: Week Number: DatePart("ww",[DateOrdered],0,2) To get the year: Year: Year([DateOrdered]) To put it together: Weekyear: [Year] & "_" & [Week Number]
The problem is when the year changes.
The dates for week 1 for 2014 are between 30/12/2013 and 05/01/2014 and therefore straddles 2013 and 2014.
Therefore when the year and week number is put together the following results are given for that particular week:
I am setting up a database for a training centre, part of this includes registration The academic year I am working with runs over 36 weeks with 24 teaching weeks, 2 x 3 week holidays, 2 x 1 week reading weeks and the final 2 weeks for exams.
I aim to set the system up so that when a user opens the application, I get the username from windows, the day and time then open the correct register. That bit should be fine.
As I have 36 weeks I want to some how map the week numbers to the dates at the start of the term and also the holidays. There are 2 reasons for this, the first being so that when the user logs in the register only shows the current week instead of needing to search along all 24 or 36 entries, the other reason is so that when checking the whole register the holidays are not shown.
Does anybody have any suggestions or pointers as to how I can do this?
I am trying to write some VBA to convert a date into a week number.
My work colleagues do not not what system is used to define the week numbers. So I have gone through all their records for a few years and deciphered this pattern:
I need the code to define that there are 52 weeks in a year. The last sunday of Dec is the beginning of Week 1 for the following year. Except when it is a leap year where Week 53 exists. otherwise it only goes up to week 52.
Start day for the week is Sunday. End day is the Saturday.
Some examples to check against:
22nd December 2013 = Week 52 2013
29th December 2013 = Week 1 for 2014 ----
21st December 2014 = Week 52 for 2014
28th December 2014 = Week 1 for 2015 ----
20th December 2015 = Week 52 for 2015
27th December 2015 = Week 1 for 2016 ----
25th December 2016 = Week 53 for 2016
1st Jan 2017 = Week 1 for 2017 -----
Tried various methods already
iso 8601, wrong week start day
intWeek = DatePart("ww", datDate, vbSunday, vbFirstFourDays) Was right for 2013 but wrong for later dates.
I want the number of days between a specific date (roll out date) and 12/31/2005 so that I can use the number to project revenue for this year.
This is what I'm using but it doesn't give me the right number. I don't know how to transform something to a datetime variable so maybe that's the reason. Can you help me out?
Expr4: Day(12/31/2005-[Scheduled Roll Out Date]-0.49999)
I've restructured my 'application' to have one table and a lot of query/forms. In light of not figuring out the combo box situation I altered the requirements and what I needed thinking I may have an easier go of it, but alas not exactly my experience. I have 5 reports that I want to filter them by week(start of the week). I have a function which can turn any regular date entered to the start day of the week(monday). I thought my best way about this would be to fill a combo box with all the accepted dates through a separate table's column.
Is there a way to pop a dialog box when the user clicks to generate the report that will prompt them to choose a week then run that criteria against the report and only bring back that date?
I would like to enter a week dates forward after looking up the last entered date. i have working codes that looks up the last date and increments it by one and enter the date into a new field.
Here is what i have:
Private Sub Form_AfterUpdate() Dim dtmNextDate As Date Dim dtmLastDate As Date Dim SDate As Date LastDate = Nz(DMax("[SDate]", "schedule"), _ DateAdd("d", -1, Date)) NextDate = DateAdd("d", 1, LastDate) CurrentDb.Execute "INSERT INTO Schedule(SDate) VALUES ('" & NextDate & "');" End Sub
enter dates into 5 new fields instead of one using a loop maybe.
Hi, I will really appreciate ur help. I work on Access-2000 database and have a problem. I need to get the number of the week. So i used the funktion as a standard value as following: "=((Monat(Datum())*30,5-Tag(31-Datum()))/7)" It shows me for today 39 instead of 44. Could u please help me and tell me why this funktion doesnt work? Thanks in advance
I have a large report that runs a six weeks average based on the last six weeks of production. Our fiscal year starts November 28th and our weeks starts on Monday.
I have used the following format to start the week on Monday
Week1: (DatePart("ww",[EntryDate],2))
To set up the fiscal year I used the following format in my query.
FiscalYear: IIf(Format([EntryDate],"mmdd")>"1127",DatePart("yyyy",[EntryDate])+1,DatePart("yyyy",[EntryDate])) . The criteria is 2006
I have a Weekending table that I have all the weeks listed including the weeks in calendar 2005 that are included in our fiscal 2006 that I have linked to my query.
When I run the report, it will not include weekending 1/1/06 (Week 1). It is totally eliminated. There is probably a conflict in the above formats, but I am not knowledgable enough in Access to figure it out. I have been searching this site without success. I would appreciate any help I can get. Last week I had to do the reports manually because I couldn't get the works to run right.
I currently have a query of between dates which the user enters, but when I try to get a total count of model numbers it gives totals for each date. I am trying to get a count of model numbers between these dates with the dates excluded in the grouping.
Basically I have a report that shows any 'Issues' that wasnt closed within the KPI Target.
I have the report working, but I simply want to do a count of how many days the observations overran the 'Target Date of Closure'.
The report also shows observations that are not closed but passed their Target Date of Closure. These observations will not have a 'Actual Closure Date', but I would like to still have a count of how many days its overrun closure.
This is a formula I tried to piece together but obviously not correct as it's not returning anything;
IIf(IsNull([Issues]![Actual Closure Date]),DateDiff("d",[Issues]![Target Date of Closure], Date()),DateDiff("d",[Issues]![Target Date of Closure],[Issues]![Actual Closure Date]))
I would like to ask for help on my current problem.
I need to input a date on a text box and another text box say txtweeknumber should determine the week number the date falls on the current month.
for example:
May 1, 2005 should fall on week 1 and txtboxweeknumber should say Week 1 May 9, 2005 should fall on week 2 and txtboxweeknumber should say Week 2 May 17, 2005 should fall on week 3 and txtboxweeknumber should say Week 3 May 25, 2005 should fall on week 4 and txtboxweeknumber should say Week 4 May 30, 2005 should fall on week 5 and txtboxweeknumber should say Week 5
Same goes for all months. Is there a function to determine which week number of the current month the input date falls?
i would like to display the date and week number on one of my forms but have no idea about dates and how to code this. can some one help? id appreciate it it beyond me :confused:
Help!! I have 2 fields in a table one for a year and one for a week number that data is being collected against. I need to change these to a month and year for the report. Is there a way to do this??
I am trying to avoid the creation of a lookup table where I know I should be able to calculate this. I need to determine the start and end date of a week number. I did find this post from 2002: http://www.access-programmers.co.uk/forums/showthread.php?t=33116&highlight=start+end+dates+week but it doesn't seem to work.
What I am trying to do is show all projects that were opened at the start of a week number. For example, week 2 is from 1/7/2008 and ends on 1/13/2008 (provided that your week starts in the week that 1/1 occurs and that your week starts on Monday). I need this start date so I can show all projects that started on or before 1/7/2008 and were in an open status.
If I can't calculate this then I will have to create a table and relate the query to it.
When using the Format:'yyyy mm dd' in access queries. When trying to show a week is there a way to show the date range instead of week number.
Week 01 = Jan1-7. If the results are only week numbers that makes it hard for people to understand when it actually is. Bottom line is: I would like to convert Week number to actual date range. Can anyone help with this?
I have a summary form with the company name,week number, week-ending automatically populated. e.g. this week is week 4 and users enter records for week 4 as the week number is automatically generated. Basically the system will just recognise today's date and generate the week number. Problem is I am trying to display previous week records and I do not know how to filter it as my week number is generated automatically, week by week. All the other forms are linked to this week number. How can I display records for a specific week that I want? say, I want to display all records for week2, etc. I am dumbfounded as I am on a learning curve with Access.
I built the below query to count the number of ID's for each week. The problem is that if one month ends mid-week it is counting the next month's IDs in the first month. I need to count the number of IDs within each week by month. I have the first qryGroupbyWeek that assigns a week number to each date then the below query to aggregate.
Code: SELECT qryGroupbyWeek.Week, qryGroupbyWeek.[Approved Date], qryGroupbyWeek.ID FROM qryGroupbyWeek WHERE (((qryGroupbyWeek.[Approved Date]) Between [start] And [end])) ORDER BY qryGroupbyWeek.ID;