Queries :: Counting Number Of Days When Item Used For Last Week

May 27, 2014

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.

View Replies


ADVERTISEMENT

Queries :: Counting Number Of IDs For Each Week - GroupBy

Oct 22, 2013

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;

View 2 Replies View Related

Reports :: Count Number Of Days Each Week (7 Days) Person Has Worked

Jan 24, 2014

I have to count the number of days each week (7 days) that a person has worked - simple enough.

But - what if they come off the job within the week?

I have been using the DateDiff function which is fine.

In the database they have a Mobdate and a DeMobDate but if the DeMobDate falls within the week the whole thing falls apart?

View 2 Replies View Related

Queries :: Counting Days Between Dates - Vacation Period And Work Days

Sep 11, 2014

I have a form called subfrm_vactions

rowsource is a query called qryVacations

the query should calculated two things

1 - the difference between start_vac and End_vac in days to calculate the vacation period and put the value in field called Period (working well)

2-the work days which the period between the last day in Previous record (End_Vac) and the (Start_Vac) in the next record (didn't work)

the result is the difference between (End_Vac) and (Start_Vac) in the same record which i don't want

simply i want to calculate the work days.

View 5 Replies View Related

Counting Number Of Days That Contain Records

Feb 11, 2007

I've been searching the Queries Forum for help on this issue. I have a database that records loading records for a Taconite facility. Some days contain many records and on other days there are no records because of no loading activity. I create reports that group these loading records by each day, but I really need a quick and dirty report that just shows me the number of days in any month in which we had loading activity (records present). I have not figured out a way to create a query which counts the number of days in a month which contain records. I'm hope I'm explaining this well enough for someone to help me understand what to do.

Thanks ... Erik

View 5 Replies View Related

Queries :: Number Of Days Between Two Dates With Irregular Days Worked

Apr 14, 2014

I have a form where a start date is inputted (Inputfrm , StartDate) and a form where the end date of the process is recorded (Inspectionfrm , EndDate) and these both record in the table InputTbl as StartDate and EndDate respectively.

I have created a union query which shows a list of all the dates where there is work recorded (WorkingDatesQry and the column of list of unique dates is "WorkingDate"), and as we run a highly varied schedule depending on time of the year and order numbers I cannot just use a query which says Monday-Friday or Tuesday - Saturday.What I am trying to do is to find the number of days between StartDate and EndDate where there is a date recorded in the WorkingDates query.

View 1 Replies View Related

Queries :: Counting Days Between 2 Dates - Just Workdays

Oct 11, 2013

I have 2 dates that I need to count between. Easy enough just use the datediff right? Nope cause it won't count just the 5 workdays. I researched and found that the "w" in the function doesn't work the way I need it to. I found lots of code to make a module that will do it for me and they all include having a holiday table. Right now I don't need a holiday table I just want the simple dates in between.

View 2 Replies View Related

Queries :: Week Number Query When Year Changes

Feb 28, 2014

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 ?

View 9 Replies View Related

Queries :: Unable To Get Current Week Number

Jan 10, 2014

I need to a query on the week number, the week number is in the table. Imjust struggling with getting the current weeks data.

View 10 Replies View Related

Queries :: Return Week Number On The Basis Of Date

Jan 23, 2014

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.

View 4 Replies View Related

Queries :: How To Reduce Number Of Item With Update

Nov 20, 2014

How do you update a table by reducing a number by 10?

My assignment question is:

10 students have left GY101. Write an SQL UPDATE statement to reduce the class size by 10 for all modules taken by GY101 students.

I can display the students who take GY101 with the following code

SELECT moduleCode, classSize
FROM ROOM_BOOKING1
WHERE moduleCode IN (SELECT modCode
FROM STUDENT_REG1
WHERE sID IN (SELECT id
FROM STUDENT
WHERE courseCode = "GY101"));

But how to reduce the number by 10.

View 1 Replies View Related

Queries :: Input Number Of Days When Prompted

Aug 13, 2014

This is the criteria of the query I am using

<=Now()+91

How can I change that so I can input the number of days when prompted ...

View 3 Replies View Related

Queries :: Calculates Number Of Days / Month / Year

Sep 15, 2013

I am building a report and need to know the coding in the query (or in the report) to achieve the following.

Currently, in my query - 3 fields that work fine:

AppDate - dates of set appointments (Appt)

MonthNo: DatePart("m",[App_Date]) - get Month value

YearNo: DatePart("yyyy",[App_Date]) - get Year value

What I need is : EXACT coding to get these counts to show in my report:

January 2013
12 appointment (there were a count of 12 appts in January)
over 23 days (there were 23 days where appts were booked in January)
of 31 days (total number of days in the month of January)

February 2013
18 appts (there were a count of 12 appts in February )
over 19 days (there were 23 days where appts were booked in January)
of 28 days (total number of days in the month of February )

etc.

View 3 Replies View Related

Queries :: Calculate Number Of Days Between Two Dates Using IIF Statement?

Nov 21, 2014

I'm trying to calculate the number of days between two dates using the iif statement

Fields:
[LDW] "Last Day Worked"
[ReturnedDate]

DESCRIPTION: If ReturnedDate is null, then calculate the datediff "d" between LDW with Now(), if not, then calculate the datediff "d" between LDW with ReturnDate.

I tried this but it didn't work at all.

Days Absent: Iif(isnull([ReturnedDate],(DateDiff("d",[LDW],Now())),(DateDiff("d",[LDW],[ReturnedDate])))

View 2 Replies View Related

Queries :: Calculate Total Number Of Days Between Two Dates In A Query

Feb 18, 2015

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]))

View 2 Replies View Related

Counting By Week

May 29, 2005

What I would like to do is get a count of the product sold and view it over a ten week period in this case week one starts 26th June.

Wk1, Wk2, Wk3 ....

x 10 5 15 etc
y 20 4 12




in the format above but I am not sure how to achieve this, I have the following:


SELECT COURSEBK.[COURSE-DSName], COURSEBK.From, COURSEBK.Description, Count(COURSEBK.[COURSE-DSName]) AS [CountOfCOURSE-DSName]
FROM COURSEBK
GROUP BY COURSEBK.[COURSE-DSName], COURSEBK.From, COURSEBK.Description
HAVING (((COURSEBK.From)>=#6/26/2005# And (COURSEBK.From)<=DateAdd("ww",+10,"26/06/05")))
ORDER BY COURSEBK.From;

(the above is working despite access changing the date format between the hashes)


regards in advance foir guidance

View 5 Replies View Related

Queries :: Crosstab Query - Counting Number Of Records For Each FY

Sep 19, 2013

I have been tasked to create a DB for my unit. I have created a few DB, but I am a novice at best. I need a crosstab Query to count the number of records for each FY. The Army's FY is from Oct -Sep. I only need to show the the total number of record for the previous FY in a Report and on a form.

View 7 Replies View Related

Queries :: Counting Total Number Of Returned Results From Query?

Aug 11, 2015

I'm trying to run a line of code after doing a Query Search that reports back the total number of results pulled from the search. I've dug around and found some useful code, but nothing that gives the results I'm needing. Most everything gives me the total number from the query. I'm also using a Split Form.

The process goes: Enter numeric search in Text10 and hit the search button to run the following macro: [studentID]=[Forms]![Query1]![Text10]

It then gives me the requested information.I have a second text box (Text19) that needs to display the number of pulled results. I've written VBA that only gives me the total number searched for studentID or for the entire Query.

Can I simply add an additional line to the Macro?

View 7 Replies View Related

Queries :: Counting Number Of Machines In Department And Total Migrated

Nov 7, 2013

I have an access dbase with a single table

I am interested in reporting so need totals, I can write a query that will count the number of machines in a dept like so

SELECT [Computer Inventory].Department, Count([Computer Inventory].ID) AS CountOfID
FROM [Computer Inventory]
GROUP BY [Computer Inventory].Department;

This works fine, however I now want to add more so are two fields

To_be_migrated
Is_migrated

These are just checkboxes so I assume criteria is true or false

I need a query which will give me

The total number of machines by dept
The total marked for migration
The total migrated

View 4 Replies View Related

UDF To Count Days And Convert To Month / Week / Day

Jul 18, 2014

Recently, my parents have bought a campground and I agreed to attempt to build a database which they can useto keep track of openings, reservations and I want to be able to now calculate the price for the customer. I know I can easily create an "invoice" using the forms.

Originally, I thought this would be easy and it actually wasn't too difficult, I had everything set up to go. Then I hit a snag. The prices are by days, weeks, months and season and get slightly cheaper for each tier you go up. Charging for a week is cheaper than charging the daily rate seven times, makes sense right? it makes it difficult for me because, I'll use the example of nine days, for a stay like this you would charge for one week and two days.

I can't just convert the days stayed into a number like 1.3 weeks and multiply it by the weekly rate because it would be undercharging the customer by about $30 and this number would go up as the stay got longer. I know I could do something like an "IIf" statement but in order to cover all the variables, that would be a long equation with lots of spots where a mistake could be made.

Through doing research, and asking here, I figured that it would be best to develop a UDF which would take the number of days stayed and convert it to something which would count them and turn it into a number like "1 week, 2 days". From there I will have to figure out how to make it so that the program knows which sections to multiply by which rates to build the price. I have taken a course in Access and have a huge book relating to the subject but I'm not quite sure where to begin.

View 1 Replies View Related

Week Commencing Day From Week Number

Nov 6, 2006

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?

View 13 Replies View Related

Calculate Sumproduct Of COST Between Any Two Fields (days Of Week)

Feb 7, 2013

The client db is not Normalized. I understand their requirements and the current table structure has to remain in tact. The DATA ENTRY staff need to enter cost for Jan1 to Jun30. One of the many calculations that needs to be updated daily is the SUMPRODUCT from STARTDATE to ENDDATE - which can be anywhere between Jan1 to Jun30 at any time. The example scenario below needs to calculate the sumproduct of COST between any two fields (days of week).

For example, let's say a Purchase Order has been created, and the initial entry looks like this:

StartDate = Jan30
End Date = Jun3
Jan1 thr Jan29 Cost = 0
Jan30 Jun3 Cost = 500 (average daily burn rate)
Jun4 thr Jun30 Cost = 0

... and the staff receives and update to the daily spread. The Cost Spread between Jan1 to Jun30 NOW looks like this:

StartDate = Jan15
End Date = Jun3
Jan1 thr Jan14 Cost = 0
Jan15 thr Mar29 Cost = 1000
Mar30 thr Jun2 Cost = 3000
Jun3 thr Jun3 Cost = 500
Jun4 thr Jun30 Cost = 0

Here is the code I am using to calc the SumProduct upon initial entry WHERE the 'average daily burn rate' for the entire spread is the same every day (FYI, we need to calculate the YearTo-Date (YTD) and Remaining Balance from YTD for both Commitment and Incurred cost. For this example I am only snipping the code here to reflect Incurred)
'Initial Calculations

If CurrentDate <= frmStartDate Then
SUMPRODUCTYTDIncurred = ZeroValue
Else
SUMPRODUCTYTDIncurred = Round((DailyBurnRate + DailyBurnRate * NoDays), 2)
End If
If CurrentDate <= frmStartDate Then
SUMPRODUCTRemainingIncurred = ZeroValue
Else
SUMPRODUCTRemainingIncurred = Round(DailyBurnRate + DailyBurnRate * (DateDiff("d", CurrentDate, frmEndDate)), 2)
End If

In my UPDATE SCRIPT (not shown - cause its TMI):

- I am using the For Each statement to search an ARRAY to filter for the db.TableDefs("MYTABLE").Fields I need to update.
- I am also using a Do While True statement to catch the cost for the found field.

How to catch all the cost between Jan1 to Jun30 before updating the SUMPRODUCT field and then .MoveNext until EOF (remembering that the For Each statement will stop when field Jun30 is found)?

View 1 Replies View Related

Counting The Days

Dec 1, 2005

could someone please help me. ive tried all sorts of things and now im loosing the will to live.
under the data protection act i have 40 days to produce requested files in a hospital. the problem is that my little database that has been working away for 2 years is not capable of flagging up any files that are gone over the limit.

i need to run a query that will bring up all files not completed in the past 40 days. or reaching the forty day limit.

ive tried <now()-40 or <date()-40 in the critieria of the date rquested field. ive also tried kicking the machine when my boss isnt looking. that didnt work either.

im sure this aint rocket science.

samzie

View 3 Replies View Related

General :: Assign Preferred Days Of Week When Volunteer Want To Work

Jul 26, 2014

I created a database for an organization I volunteer for but I am running into design problems. I want the database to be able to assign preferred days of the week (that the volunteers want to serve) with the flexibility to change them.

The problem is in order to be able to keep my reporting options flexible. I will have to write a record (on a separate table) for each volunteer for every day they want to serve. A one to many relationship between the volunteer table and preferred days table.

View 5 Replies View Related

Counting Days Between Services

Oct 4, 2006

Hi guys

bit of a newbie here....but could you pls help me on this one!!!
Í have a table that looks kinda like this:

SRVDate - Date/Time
Fleet_Num - Text
Odo - number
ServiceType - Text
ServicedBy - Text
DiffOils - YES/NO
Gearbox_Oils - YES/NO
ValveAdjust -YES/NO

I need to extact the fleet numbers, the day the last 5 "B" services were done and then calculate how many days between each "B" service....

Kinda like this:

Truck1 B Service 01/01/2006
Truck1 B Service 01/02/2006 31 Days since last service
Truck1 B Service 03/02/2006 2 Days Since last service

I know how to extract all the data but its the subtracting the dates that killing me!!!!
Any help guys?

View 11 Replies View Related

Counting Consecutive Days

May 19, 2005

Hi,

Is it possible to count the number of consecutive days in a table?

I need a query to calculate for a particular customer the number of consecutive days thay have logged a record if its greater than 1

EG: Table layout:

CUST A RC1 05/05/05
CUST A RC2 06/05/05
CUST A RC3 07/05/05
CUST A RC4 08/05/05
CUST A RC5 15/05/05
CUST A RC6 18/05/05

Possible query results:

CUST A 4 Days First 05/05/05 Last 08/05/05

Is it possible to do something like this??

Thanks in Advance

View 1 Replies View Related







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