Grouping Dates Into Weeks?

May 8, 2005

Hello, I am new to Access and I am having a problem with something. I have a query which returns, among other things, dates. I need to organize (group) the dates into weeks. Does Access have a function which could do this? Or some other way of grouping the dates? Or How would I got about writing a function in Access?
This is done in a Pivot Table right now, and I just use a calculated field which is the date / 7. This gives some god awful numbers (like 5944), and not anything like what I want. I would want the function to return something like,
"Feb. 5, 2005 - Feb. 12, 2005". Any suggestions?

View Replies


ADVERTISEMENT

Query Mondays (Dates) In Last 52 Weeks

Mar 5, 2008

My main query has a list of events with the corresponding dates that they occured.
I want to create a second query that shows Monday’s date of the current week and the Monday date of the preceding 51 weeks.

How do I get my second query to show the dates for 52 consecutive Mondays starting with the current week (Monday date) and going back 51 weeks.

Then I want to create a third query by combining the first two such that the with the dates and events main query are displayed and grouped by the Monday dates for the year query.

2nd QryMain Query
MondaysEvent #Date
8/6/2007789328/6/2007
8/13/2007
8/20/2007
8/27/2007
9/3/2007
9/10/2007
9/17/2007
9/24/2007
10/1/2007
10/8/20078089910/8/2007
10/15/2007
10/22/2007
10/29/20078179111/1/2007
11/5/20078199111/8/2007
11/12/2007
11/19/2007
11/26/2007
12/3/20078269712/5/2007
12/3/20078274812/6/2007
12/3/20078278612/7/2007
12/10/2007
12/17/20078311112/18/2007
12/24/2007
12/31/2007835531/4/2008
12/31/2007835611/4/2008

View 9 Replies View Related

Queries :: How To Calculate Number Of Weeks Between Two Dates

Jun 25, 2013

My database includes two separate dates related to a vehicle purchase and default payments resulting in repossession. I need to find out how many weeks passed between those dates.

Example:
03/14/12 Date of automobile purchase
06/06/13 Date of last payment before default

How many weeks in between? And then I need to average all of those figures so my company can see the usual week-term time frame that our customers are defaulting and getting repossessed.

View 5 Replies View Related

Grouping Many Different Dates

Aug 1, 2006

I have a query which has many sums and counts on things like "Company name", "region name" and "Development Name".

I'm using this query for a report to do lots of percentages with, but now i need to filter this also by a date period.

So the user choses "Alex Homes" as the company name and then "July 2006" as the reporting month, and i need all the sums and counts to stay the same and only count/sum the records in the chosen month.

I can't seem to think of a way to do this.

If you need more info then ask.

View 4 Replies View Related

Grouping Columns With Dates?

Apr 8, 2012

I am working on a very large table that i have to group by Min & Max Dates.

ColumnA ColumnB
1-Jan Melbourne
2-Jan Melbourne
3-Jan Melbourne
4-Jan Melbourne
5-Jan Sydney
6-Jan Sydney
7-Jan Sydney
8-Jan Sydney
9-Jan Sydney
10-Jan Sydney
11-Jan Sydney
12-Jan Melbourne
13-Jan Melbourne
14-Jan Melbourne
15-Jan Melbourne

I want the above table to provide an output as below:

Min Max City
1-Jan 4-Jan Melbourne
5-Jan 11-Jan Sydney
12-Jan 15-Jan Melbourne

i have done this in excel by sorting dates and then comparing values in Column B.

View 6 Replies View Related

DLookUp, Dates And Grouping Data

Jun 10, 2007

Hello!

Is it possible to group data in form from table within two dates with aggregate function DLookUp,

Thanx

View 1 Replies View Related

Problem Bugging Me For Weeks Now

Apr 23, 2006

So I have a project where I have to get employees to use infopath to fill out details in a form and then submit it, the form gets saved in an access database. I have all that setup and it works perfectly. I uploaded the forms on a sharepoint site and when I open them up from my computer they submit properly to the databse. However when I open up the forms from another computer they don't submit to the database. I know why it does that (because the databases are not on every computer). I can't however figure out a way to solve this problem so ANY help would be amazing. I was thinking to have the access databse on sharepoint as well so the users can download it but won't that just make it that every single computer will have a different saved database? This problem is driving me crazy.
Thanks in advance for all the help.

View 2 Replies View Related

Can You Use Multiple Weeks In DatePart

Jun 27, 2005

I'm using the following in a query qwhich allows me to enter the week number as the criteria:

DatePart('ww',[Visitdate],2,2)

This works fine , no problems. What I would like to know, is it possible to enter muliptle week numbers in the criteria, say 14 16 21 to give me output for those weeks, I have tried different separators to no effect ie. : and ; It may be that it simply is not possible but it would be extremely useful if ti was.

View 12 Replies View Related

Selecting Weeks Of The Year

Oct 19, 2007

Hello All

I have a number of Select queries that select 1st quarter up to 4th quarter of the year for accounting purposes. These are quite simple queries such as:

between "10" and "24" entered in the Criteria window. 10 and 24 being week numbers.

However if I wish to randomly select the week numbers after the query is loaded what is the correct code?

Regards
Terence
London

View 3 Replies View Related

Weeks In Wrong Order?

Jan 11, 2008

Hi everyone!

I have two columns. In one of them I have daily dates and in the other I have some numbers. What I'm trying to do is to sum the numbers weekly by entering this in the field of a query:

Week: Format([Date];"yyyy ww")

The problem is that when I go to datasheet view, it is sorted wrong.
It looks like this:

2007 1
2007 10
2007 11
2007 12
.
.
.
2007 19
2007 2
2007 21

But I want it like this;

2007 1
2007 2
2007 3
2007 4
.
.
.
2007 9
2007 10
2007 11

and so on...

The other column has the rihght values for each week, but I need it in the right order...

What am I doing wrong? Or how can I fix it?

Thanks in advance
Jake

View 8 Replies View Related

Count By Weeks Not Individually :(

Nov 27, 2007

Hello all!, I am new to the form

I have one problem I can't seem to get to the bottom of. I have a database that counts the attendance of my basketball team. Everything works great but I have one problem. Our basketball program is 12 weeks for each student. Now students can join any time but all of them are required to stay 12 weeks to complete the training. How do I get Access to tell me how many weeks a student has left in the program? As i was saying it is easy for me to add together the days of the week that the student attended, but I can't seem to figure out how to get the amount of weeks a student been attending. One more thing, I know this is asking alot but is there a way to have an extra column that allow me to add additional weeks to certain individuals (for the students that like to skip a week or to)?

Any help would be appreciated

View 4 Replies View Related

Query Weeks Over Multiple Years

Aug 17, 2005

I have a database that I am using to report metrics based on seasonally available data. What I am running into is the problem that the seasonally entered data doesn't start on the same date every year.

An example:
I have data that was entered into my database last year starting July 26, 2004. This is considered part of week 1 of my season and I want to compare that data to records that started being entered on August 15, 2005. Which is week 1 of the 2005 season.

Records include the following information: id, date, other irrelevant details

Does anyone have any ideas on how I might be able to accomplish this? Thanks in advance for your help!

View 1 Replies View Related

Union Query Not Working, But Did 2 Weeks Ago

Sep 30, 2007

Hi there,
Was there a recent update or something that may have affected a Union Query in MS Access 2003 (operating system XP Pro, all current updates installed)?

In our database we have a union query that display available sessions and time period of availability, this is done by identifying the session with **available** at the start of each line for some reason it works on some computers and not others.

Does anyone know anything that may effect this code in operating 100% of the time?


thanks in advance.. Colin



The SQL code used is a follows:-

SELECT '** available **','', '',format(A.session_end, "dd/mm/yyyy") as START_DATE,format(A.session_end,"hh:nn") as START_TIME, format(B.session_start, "HH:MM") AS END_TIME, int(DateDiff("n",a.session_end,b.session_start) / 60) AS Expr1, (DateDiff("n",a.session_end,b.session_start) - expr1 * 60) AS Expr2,a.session_start
FROM session_last AS A, session_last AS B
WHERE (((B.session_start) Between (([Forms]![Bookings]![StartDateInput])) And (([Forms]![Bookings]![EndDateInput])) And (B.session_start)=(SELECT MIN(C.session_start)
FROM session_last C
WHERE C.simulator_code = A.simulator_code
AND C.session_start BETWEEN (([Forms]![Bookings]![StartDateInput])) AND (([Forms]![Bookings]![EndDateInput]))
AND C.session_start > A.session_start
)) AND (((A.simulator_code)=[Forms]![Bookings]![simulatorCodeCombo])) AND ((A.session_start) Between (([Forms]![Bookings]![StartDateInput])) And (([Forms]![Bookings]![EndDateInput])))
AND ((B.simulator_code)=[A].[simulator_code]) AND (([B].[session_start]-[A].[session_end])<>0))


UNION SELECT '',C.customer_code, C.session_type, format(C.session_start, "dd/mm/yyyy"), format(C.session_start,"HH:MM"), format(C.session_end,"HH:MM"), int(DateDiff("n", C.session_start, C.session_end) / 60) AS Expr3, (DateDiff("n", C.session_start, C.session_end) - expr3 * 60) AS Expr4,c.session_start
FROM session_last AS C
WHERE (C.session_start) Between (([Forms]![Bookings]![StartDateInput])) And (([Forms]![Bookings]![EndDateInput]))
AND (((C.simulator_code)=[Forms]![Bookings]![simulatorCodeCombo]))
ORDER BY 9, 4, 5, 1;


END of SQL code..

View 2 Replies View Related

Selecting Random Weeks Of The Year

Oct 19, 2007

Hello All

I have a number of Select queries that select 1st quarter up to 4th quarter of the year for accounting purposes. These are quite simple queries such as:

between "10" and "24" entered in the Criteria window. 10 and 24 being week numbers.

However if I wish to randomly select the week numbers after the query is loaded what is the correct code?

Regards
Terence
London

View 3 Replies View Related

Display Last 13 Date Weeks In Query

May 13, 2005

Hi,

I have created a basic query, in MS 1997

Would someone be kind enough to give me the code for the following,

I need to display only the last 13 weeks worth of dates in this query.

The table is called "Tbl_History_RotAwaitShip"
The field is called "Time/Date" and is formatted as "13/05/2005"

Thankyou

View 2 Replies View Related

Crosstab Query For Last Twelve Weeks

Jul 15, 2005

I am trying to create a report which will show the last twelve weeks of orders by client. In the table I have an Order Date and of course the bill to clients. I tried to create a Crosstab query for the wizard and can get month by month but need the last twelve weeks, week by week. Is there a way to do this?

View 1 Replies View Related

Modules & VBA :: Convert Weeks To First Day Of Month

Feb 28, 2014

I am trying to convert a week which is entered in a text box on a form to the first day of the month in which it falls.

My text box (txtdw) is in the format yyww and I want it to be converted to 01/mm/yyyy.

example: 1401 would convert to 01/01/2014. 1406 would convert to 01/02/2014.

I am pretty close, I can get to the correct month but I can't work out how to change to the first day of the month.

Code:
DateAdd("D", Right(Me.txtDW, 2) * 7, DateSerial("20" & Left(Me.txtDW, 2), 1, 1))

View 4 Replies View Related

Count Working Weeks In Selected Month

Jun 2, 2006

I think i am missing the obvious but cannot seem to get this one....

I am trying to get my form to return a value of the amount of working weeks in a month i.e. a 4 week month (like june - 4 mondays) or a 5 week month (like may - 5 mondays).

i can calculate the number of full weeks using the control source..

=Int(DateDiff("d", Date1, Date2) / 7)

but this does not work for the 5 week months?

Any help would be greatly appreciated.

View 5 Replies View Related

Selecting Week Of Records From This Weeks Date

Jun 27, 2005

Hi,

I am trying, and getting nowhere...so would appreciate your help... to create a query where records with dates from 8 weeks, or two months ahead appear in the query.

That is I have contracts ending in two months in my table and I want to run a query on who I should call now to renew contracts.

I have a contract end date in table.

I have tried
>=DateAdd("m",2,Now())<=DateAdd("m",2,Now())
only to get all sorts?

>=DateAdd("d",60,Now())<=DateAdd("d",68,Now())
only to get all sorts of things appearing?

Anyone that could help would be great.
I have contact info in a TBLCONTACTS and linked to TBLMOBILES via COMPANY_ID

Thanks heaps!

C

View 2 Replies View Related

General :: Last 2 Weeks Of Records Missing From Database?

Mar 27, 2014

I've got a database used daily by 4 users. It's split into a frontend (10MB) with all the forms/queries/reports/vba and a backend that's just tables (170MB), and the users access the database from a network drive. All additions through the forms are logged to a text file, and at the end of the day, a report is run that prints the day's work to a PDF. The database / workflow has been stable for the last few years, with only minor edits to the code, and no programmatic changes in the last 3 months.

Today, after running a compact-and-repair, I realized that the database contained no entries added within the last 2 weeks. I checked my log files, and sure enough I see that all of my records were at some point added to the database. This is supported by the fact that I have PDFs for every day in the last 2 weeks that show exactly what was done (roughly 30 new records/day).

My first guess was that compact and repair had corrupted the database, and knocked out a chunk of records. Fortunately, I've got daily backups, so I started restoring to yesterday's database. At this point I found that the records were missing from there, and from every backup from the last 2 weeks. Now, it's possible that my backup solution (logMeIn backup) is hosed, but the the log files are getting properly restored by the backup, which leads me to believe the backup is working. So, somehow these records were never saved in the database, yet they magically appeared in my end-of-day reports?

I thought maybe I was getting stuck in some state where the database went read-only and the edits were getting stored in memory but never written to disk, but that doesn't make sense as we occasionally restart the database during the day for other reasons, and the end-of-day reports are always complete, which knocks that out. Having restored to a prior version of the DB, I attempted to make changes / add new records and they appear to be sticking, but I find my faith in Access rather shaken, all the more so because I haven't a clue what went wrong before.

View 2 Replies View Related

Date Query (last Week, Last 2 Weeks, Last Month, Last Year, All)

May 31, 2007

Hi

Would be great if I could get some help on this:

I have big table that gets updated almost every day with new data. There is a date column. I have a Form where I can enter queries. I need to add a panel where I can spcify if the query should involve the data should involve the date from last week only, from the last 2 weeks, from the last month or if the query should involve the overall data.:confused:

It somhow need to be check what the date is today and then caclulate back.

Any help on this would be much appreciated.:D

Thanks
Daniel

View 6 Replies View Related

Modules & VBA :: Display Following Weeks Monday Date In Textbox

Mar 11, 2014

I have a textbox in a form. What I want it to do is to display the following weeks Monday date. Sounds simple but requires you to know the Monday dates in advance ...

View 14 Replies View Related

Queries :: Job Scheduling Database - Output Unique List Of Weeks

Sep 1, 2014

I'm writing a simple job scheduling database, so I've got resource availability (by week) and job list (by week). I've written a single-column query whose only output is a unique list of weeks with resources available, and another single-column query whose only output is a unique list of weeks with at least one job allocated.

How do I join these so that I can get a single-column list of weeks that have either (or both) of resources and jobs?

So Query1 returns:
25/08/2014
08/09/2014
15/09/2014

while Query2 returns:
01/09/2014
08/09/2014
15/09/2014
22/09/2014

I want query3 to return:
25/08/2014
01/09/2014
08/09/2014
15/09/2014
22/09/2014

View 5 Replies View Related

General :: Calculating Number Of Weeks Between Start And Finish Date

Jun 9, 2015

I am calculating number of weeks between start and finish date. Some of the users have questioned the validity of calculation as they are not too sure if this is being calculated as Monday to Friday week or does it work by calculating 7 days. If the latter is true, then I should see a decimal value. I am using date diff formula.

View 12 Replies View Related

Queries :: Query Multiple Records Between (Weeks) Where No Record In Child Table?

Jul 1, 2014

I am trying to determine the best method for how to handle this query using Access 2013. I have a clients table that contains the following:

clientID fName lName admissionDate dischargeDate
1 John Doe 05/06/2014 06/27/2014
2 Jane Doe 04/24/2014 05/15/2014
3 Steven Smith 05/15/2014 NULL/Empty
4 Chris Davis 06/12/2014 NULL/Empty

Then there is a WeeklyProgressNotes table that is there for the person that is responsible for auditing the clients charts. It does not contain the actual weeklyprogressnotes, it only contains a Yes/No field and a date field for the date the weeklyprogressnote was completed. Like below:

noteID completed dateCompleted clientID
1 yes 05/08/2014 1
2 yes 05/14/2014 1
3 yes 04/25/2014 2

I am creating a form that the auditor can open to determine what weeks she needs to check for each client to see if they have their weeklyprogressnotes completed that week. The weeks run Mon - Sun and there will be no record in the WeeklyProgressNotes table if she has not yet checked and confirmed for that week. So the form would basically look like this:

fName lName week completed date clientID(hidden)
John Doe 5/19/14-5/25/14 Checkbox Null 1
John Doe 5/26/14-6/1/14 Checkbox Null 1
John Doe 6/2/14-6/8/14 Checkbox Null 1
John Doe 6/9/14-6/15/14 Checkbox Null 1
John Doe 6/16/14-6/22/14 Checkbox Null 1
John Doe 6/23/14-6/29/14 Checkbox Null 1
Jane Doe 4/28/14-5/4/14 Checkbox Null 2
and so on.......

I have thought about creating an SQL statement to select all of the clients and then creating a function that determines their admission date within the specific week and their discharge date withing the specific week and then create a loop with another SQL statement with a BETWEEN clause for all the weeks and determine if there is an entry in the WeeklyProgressNotes table or not. If not then I would display out the above info. I'm not sure if there is an easier, less search intensive way of doing it. Maybe an SQL query that can cut done on some of the looping.

View 5 Replies View Related

Forms :: Dates As Column Headers To Update Table With Dates As Rows

May 12, 2014

Any way to have a form with Dates as column headers to update a table where the dates are stored in rows???

The table set up is like this:
tblOpHdr
DiaryID (PK) - OpDate (Date)

tblOpDetail
DiaryID (FK) - CostCode - MachineNumber - MachineHours - etc

I'm just wondering if there's any way I can do this with a datasheet or a crosstab type setup?

It's Access 2010.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved