Queries :: Unable To Get Current Week Number
Jan 10, 2014I need to a query on the week number, the week number is in the table. Imjust struggling with getting the current weeks data.
View RepliesI need to a query on the week number, the week number is in the table. Imjust struggling with getting the current weeks data.
View RepliesHello everyone.
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?
Please help.
Thanks,
Edwin
I've been asked to edit a current report that lists our production in week number order. I need to look at way we can 'flag up' orders that are within a 4 week period from the current date.
For example,
10 Orders in total in our database. 5 of which are due the drawings back within 4 weeks from today (26/02/15). I'm looking for a way for the report to show the 5 orders as priority, either by formatting the orders in bold, a different colour or under their own heading/group.
Curretnly I have a query setup with Area, EventDate, & Complete. I want to be able to count each occurance of complete in current week. So far I have the following criteria under EventDate.
DatePart("ww",[EventDate])=DatePart("ww",Date()) And Year([EventDate])=Year(Date()).
So, this does in fact get me the records of current week, the issue I'm having is when an area has occurences daily. It will not bulk that area into a weekly count. I just need to be able to see how many occurances happen in the week total not daily. So my results could be.
Office1 5
Office2 1
Office2 1
Office2 1
Office2 1
Office2 1
Office3 5
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:
DateOrdered - Result of above query
30/12/2013 - 2013_1
31/12/2013 - 2013_1
01/01/2014 - 2014_1
02/01/2014 - 2014_1
03/01/2014 - 2014_1
04/01/2014 - 2014_1
05/01/2014 - 2014_1
All of the above should all read 2014_1 but some obviously are 2013_1. This causes me problems when doing further analysis and cross tabulations.
How can I amend my query so that the above all show the correct year and week number: 2014_1 ?
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;
I've been trying to create a query that will take a date and return the week number of the date.
My original date is formatted m/d/yyyy
I need my weeks to start on Monday and I would like the week containing Jan 1st to be the first week of the year
I have tried using the following function:
DatePart("ww",#12/31/2001#,2,1)
but the I get a result of 53 in this query, when I expected/need it to be 1.
I need to count the days that an item of equipment is used for the last week?
The problem comes if an item is deployed within the week i.e not used for the full week?
I have two fields - MobDate and DeMobDate
I have to create a third called NOD (number of days) which will display the number of days in the previous week that the item was hired out.
I am trying to create a clean database and code to generate a report.
I am trying to count the number of null fields in one of my queries:
However, because of this expression, I cannot carry other fields with it. So the end result looks like:
But I would really like it to spit out the following information:
Total Not Fixed: 241
Department: Sustaining Eng
is there a way to create an SQL query to simply add data: I have tried the following:
Code:
ALTER TABLE qrySustainingEngNotFixed2 ADD Dept TEXT(25)
Insert Into qrySustainingEngNotFixed2 (Dept) Values (Sustaining Eng)
SELECT TotalNotFixed, Dept
FROM qrySustainingEngNotFixed2;
The above isn't working. Keep in mind that I want this is just for display purposes. I pondered making a custom table and then making a Union Query, but I'm trying to do this all in one SQL statement.
I have a query that groups records by date into week numbers using the following expression.
WeekNumber: DatePart("ww",[Date],2)
I would prefer to display the result as the week commencing Monday date.
How?
Hi I am looking for a formula for my query which filters out only the orders raised in the current week.(5day week Monday to Friday) I did not want to enter dates manualy.
Can this be done ?
Can anyone help me with this.
Tks
Hi,
I'm wondering how to set the default value of a combo box to the Monday of the current week (it's grabbing a date field).
Many thanks in advance.
I'm a bit new at all this but am trying to produce a query that filters on dates within the current week. Is there any way of doing this? I now how to do it for the day but at the moment I'm having to manually input 2 dates to get data in between them. Is there a command that will automatically detect the week and pull up dates within that?
View 8 Replies View RelatedI have a query with below formular which return's all records between Sunday and Saturday
Between Date()-Weekday(Date())+1 And Date()-Weekday(Date())+7
I can get this formular to work when it is looking at one date feild. (Date Received). I would also like it to look at the (date completed) feild so I get all records entered & completed in the previous week.
I have tried putting same formular in the OR critiria as well but cannot get it to show all records at same time.
What am I doing wrong ???
Tks
Given a specific week no. for the current year... I need to return the first date of that week....
For example : week4 of this year (returns) 19/1/2015
How can i make a conditional report that can give me some data from the table.
View 1 Replies View RelatedI have a database that lists jobs that need doing, in the jobs table there is a Deadline field, this is a Date Time field that specifies when a job must be finished by.
So I'm trying to make a query, using my limited knowledge, that displays all jobs that need finishing between todays date and the rest of the week.
So I tried this and got nowhere:
Between #(Date())# AND #(Date()+7)#
Having a bit a brain freeze today. I have a field that auotmatically puts a date in when a checkbox is checked I am now trying to add a field which returns the day of the week from this date. Brain now mashed I am sure it's pretty simple but I just can't get it to work
View 5 Replies View RelatedHi everyone,
I want to calculate the week number of a date in a year starting from the 1 July (of the current year) - as this is the beginning of the Financial Year in Australia.
The starting day of the week is Wednesday.
I've been trying to think how I could use the Access DatePart Function in a query to calculate the week number from sales records.
I have had no trouble calculating the week number from the 1 Jan using the DatePart function. However, the function doesn't allow me to select a different date other than the first week of January.
So as a work around, I've thought of calculating the week number of 1 July in the current year, and just using the DateAdd function to add the week number to the week calculated by the DatePart Function.
Not quite working yet. Here's what I've come up with so far.
WeekNumberCount: DatePart("ww",[DateCalled],4)
I use the following to calculate the "my" starting week of the year:
StartingWeekInYear: DatePart("ww",DateAdd("ww",0,"1-July-" & Year(Date())),4)
Then I add the two together together:
MyWeekNumberCount: DatePart("ww",[DateCalled],4)+DatePart("ww",DateAdd("ww",0,"1-July-" & Year(Date())),4)
I know it needs some work to be useful for all years. Any suggestions?
For some reason i'm having difficulty getting the Current Monday and Friday of the Current Week on my Main Menu. Monday shows 12/29/2014 ???
Here is the code for the scenario.
Monday: =CDate([AnyDate])-(Weekday(CDate([AnyDate])))-2+4+3-3
Friday: =Date()-(DatePart("w",Date(),2,1)-1)+4
AnyDate: Date()
I tried to follow the Allen Brown print the current record in the form and its not coming up. I can print all of the records but not the current.
View 3 Replies View RelatedForm info
1st Form Name: Mainform
Text to enter employee ID : empid
Sub form within Mainform: SFTimesheet (continues form)
text to enter: Timein, Break, Timeout
SFTimesheet shows and accept entries for each employee called using the text empid, on the mainform
I wanted the subform to show 7 days /lines starting from Sunday to Saturday of current week and dating the text "Timein" accordingly. When employee enteres an entry on the 7th Line, it should give them a new 7 lines for the new week to begin.
I am trying to add the current date and time into separate fields after an ID is entered.
Code:
Option Compare Database
Private Sub ID_AfterUpdate()
Me.Date_Received = Date()
Me.Time_Received = Format(Now(), "hh:mm AMPM")
End Sub
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.
Thanks,
Hi Folks,
I use this to get a week number for a date range:
WeekNo: DatePart("ww",[Timestamp])
Is there a way that I could also get just the first date from that week number to appear in the query as well?
ie. if Week 1 is 3/1/07-3/7/07 the query would show 3/1/07 as well as week 1. TIA