Query For Last 7 Days - Mon To Mon

Mar 18, 2008

trying to think my way around this one. i am in search of a query that will allow users to see what they have ordered within the last week (7days max) which starts on monday of each week eg if they run the query on thurs, they will see mon, tues, weds & thurs and not just 7 days from thurs [Date()-7]

i'm assuminging its gonna be something like if day=monday then query will = date() else if day=tuesday then query will = date()-1 and so on.....

View Replies


ADVERTISEMENT

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

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

Trouble Implementing The Regular Days And Sunday Working Days?

Dec 14, 2004

Hello everyone,

I have problem with my code here. I am using this code to determine if the LogDate with a weekday of Sunday can be declare as Sunday Work or Regular Work. The 1st week of my entry can determine if the LogDate is Sunday then compute if it reaches a 7 days working, if he is absent even 1 (one) day in his previous working days within the week. His Sunday LogDate is considered as Regular Days instead of Sunday Work. Can anyone tell me what is wrong in this code?

The problem here is the computation of 7 days after 1 week. There should be a 7 days computation every week per month in able to declare Sunday Work or Regular Work. I tried this code but it did not work on 2nd week, 3rd week and 4th week of the month.

How come on 2nd week, Sunday (LogDate) is not considered as Sunday Work even he completed the 7 days (working days) per week? I need help on this ASAP Thanks

Tim

Below is the code i'm using for defining Regular days and Sunday Working Days:


Private Sub LogDate_AfterUpdate()
Dim rst As DAO.Recordset, rs As DAO.Recordset
Dim db As DAO.Database
Dim dteToday As Date, dtePrior As Date
Dim i As Integer

dteToday = LogDate
dtePrior = DateAdd("d", -6, dteToday)

Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT [HolidayDate] FROM tblHolidays", dbOpenSnapshot)

rst.FindFirst "[HolidayDate] = #" & dteToday & "#"
'See if the date entered is a holiday
If rst.NoMatch Then
Holiday.Value = 0
Else
Holiday.Value = 1
End If
If Weekday(dteToday) = vbSunday Then 'If dated entered is a Sunday determine if
Dim strSQL As String 'it will be a regular day or a Sunday

strSQL = "SELECT [LogDate] "
strSQL = strSQL & "FROM tblLog "
strSQL = strSQL & "WHERE [LogDate] >= #" & dtePrior & "#"
strSQL = strSQL & " AND [LogDate] <= #" & dteToday & "#"

'Create a recordset of records from date entered and 7 days prior
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)

rs.MoveLast
i = rs.RecordCount 'Count the number of days between the two dates

If i = 7 Then 'If there are seven days then it is a Sunday
Sunday.Value = 1
Else
Sunday.Value = 0 'If less than 7 days then it is a regular day
End If

Else
Sunday.Value = 0
End If

DayofWeek.Value = Format(dteToday, "dddd")

End Sub

View 1 Replies View Related

General :: Convert Weekend And Holiday Days To Work Days

Jun 14, 2013

Is there a way i can convert the weekend days into working days for example.

5/4/13 1:30 PM is on saturday what function can I use to make this day read 5/6/13 8:00 Am which is monday. Same thing for holidays.

View 1 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 :: Missing Days - Creating Table With 31 Days Of Zero Values

Apr 3, 2013

Client has asked me to create a report showing summary of monthly sales by day. That was easy. I created a query for the month the user selected and then summarized and group the data by day. Client like the result but would like to see zeros on the report for non sales days. Non sales days are days like holidays and there are no sales.

I am thinking of creating an table with 31 days of zero values and then join the two tables in a query? Or, should I create a temporary table with code and then merge the two tables which the existing query which I can then use for the report?

View 4 Replies View Related

Date Add Problem (calendar Days Vs Working Days)

Dec 4, 2006

I have a query and I need the records to display 3 working days before the 15 working day deadline.

I used the following in the criteria box below the received date field and it doesn't pull the correct number of workdays, it's pulling calendar days instead.

<=DateAdd("w",-12,Date())

Can anyone help, thanks for your time!!!

View 8 Replies View Related

Date Add Problem (calendar Days Vs Working Days)

Dec 4, 2006

I have a query and I need the records to display 3 working days before the 15 working day deadline.

I used the following in the criteria box below the received date field and it doesn't pull the correct number of workdays, it's pulling calendar days instead.

<=DateAdd("w",-12,Date())

Can anyone help, thanks for your time!!!

View 6 Replies View Related

Calculate Days In Advance Or Days In Arrears

Dec 26, 2006

I rent out a property , on the rental statement I have a field [Datepaid], [RentpaidFrom] and [rentpaidTo]. I would to have a field that can calculate the rent that is paid to show if the rent is in arrears or in Advance. I guess the code would be something like (datediff ???? etc) but i have no idea what it should be. the calculation should appear on the query as i.e.2 days in arrears or 12 days in advance etc

your help would be much appreciated

merry christmas to you all
Jabez

View 4 Replies View Related

Calculate Working Days Between 2 Days

Mar 14, 2006

Dear All,

I'm new to VBA coding. A code below is copied from a friend of mine and I can't make it work. How to call up this function in my form. In my form I have 3 text boxes (StartDate, EndDate and NumOfWorkDays). My form is based on a table.

Please anyone who would help me on this, kindly give me the step by step procedure as I am really novice. Thanks in advance.

'*********** Code Start **************
Public Function WorkingDays(StartDate As Date, EndDate As Date) As Integer
On Error GoTo Err_WorkingDays

Dim intCount As Integer

StartDate = StartDate + 1
'If you want to count the day of StartDate as the 1st day
'Comment out the line above

intCount = 0
Do While StartDate <= EndDate
'Make the above < and not <= to not count the EndDate

Select Case WeekDay(StartDate)
Case Is = 1, 7
intCount = intCount
Case Is = 2, 3, 4, 5, 6
intCount = intCount + 1
End Select
StartDate = StartDate + 1
Loop
WorkingDays = intCount

Exit_WorkingDays:
Exit Function

Err_WorkingDays:
Select Case Err

Case Else
MsgBox Err.Description
Resume Exit_WorkingDays
End Select

End Function
'xxxxxxxxxxxxxxxxxxxxxxxx

Can someone please direct me to the right path.

Your help is highly appreciated.

qwerty70

View 1 Replies View Related

Run A Query Every 10 Days Etc

Sep 11, 2006

Hi i need to make a query run every 10 or so days as it is a query which checks if any printers in the database are running out of warranty

Can anyone help on this

I basically am trying to make this query run where if there is any data a report will preview stating this printer warranty is expiring etc

Many thanks in advance

View 1 Replies View Related

Count Days In Query

Feb 24, 2006

I got an assignment from my supervisor and I am not getting it! :(

I have a query (see result in attachment) with the following fields:
tID, emailID, emailtype and EmailDate.

Example:
A customer (tID 1297542) sends an e-mail (emailtype 1) to the company on 2-8-2005.
The company replies on that e-mail (emailtype 3) on 5-8-2005.

Problem:
I would like to create a query that shows per tID the total of days between the e-mail from the customer and the e-mail from the company (between emailtype 1 and 3).

View 4 Replies View Related

How To Get Working Days In The Query?

Nov 1, 2006

Hi, i have a problem
I need to create a query that shows me only days which r:
1. working days
2. which r not in the table on which the query is based
Thanks in advance

View 1 Replies View Related

Number Of Days Query Help

Mar 6, 2008

I imported an large Excel file with a date column consisting of 3 different date formats and need help on a query to extract the number of days. Examples of the date on that column:

7/6/2006
7/1/06-7/31/06
7/1-7/5

Appreciate any advise.

View 7 Replies View Related

Help With Query-limit On Days

Dec 26, 2005

I am working on my DB for work and am almost finished with my DB. I have a query that gives me totals for days. This is the code that I have been using.

TotalTMD: IIf([SumOfTMD Total]>=180,IIf(IsNull([SumOfLOA Total]),180,"180"),[SumOfTMD Total])

TotalLOA: IIf([SumOfLOA Total]>=180,IIf(IsNull([SumOfTMD Total]),180,"180"),[SumOfLOA Total])

The "TotalTMD" and "TotalLOA" days are limited to 180 days for each table. However what I need to do now is limit the combination of both fields to 180 days. Is this possible?

Since "TotalLOA" is more serious, I would like to use what ever days are in this field and then include what ever days are left over to total 180 days from "TotalTMD" days.

Maybe I could use this as an example:

Name TMDDays LOADays Total days
John 190 20 210
Jim 80 90 170
Tony 250 190 440

Should display:
Name TMDDays LOADays Total days
John 160 20 180
Jim 80 90 170
Tony 0 180 180

Any help would be greatly appreciated.

View 2 Replies View Related

Query The Number Of Business Days

Dec 8, 2007

Hello all,

I have 2 tables:
- Employee
- PackageTracker (Contains PackageNumber, date received, date sent, status)

I would like to query:
- which employee has the package
- How long have we had the package (calculate only business days)
- What is the status

I would like the things mentioned above to be ran in one query.

I am stuck with the calculations. I found a macro code to calculate the business days but I am stuck.

Please advise.

Thank you,


John

View 14 Replies View Related

Working Days Query Problem

Jan 11, 2005

Date Recieved: Date letter in

SLA: combo box: 7 days
15 days
20 days

SLA Date: Date recieved plus 7, 15 or 20 working days.

Any ideas on how I would do this?

View 2 Replies View Related

Number Of Days Between Dates In Query

Apr 22, 2005

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)

View 1 Replies View Related

Limit Query Results To Last 30 Days

Dec 12, 2013

I am querying a linked ODBC table with a date column called "db_created_tms" that has dates in formatted like "2/25/2004 8:54:02 PM" , because it is a linked table I can't edit the data type. How can I limit my query results to the last 30 days.

My query without the date limit currently looks like this:

SELECT QBReportAdminGroup_v_txn_po_line.doc_num_h AS po, QBReportAdminGroup_v_txn_po_line.quantity_qnty AS qty, QBReportAdminGroup_v_lst_item.name AS REFERENCE, QBReportAdminGroup_v_txn_po_line.unit_price_amt AS cost, QBReportAdminGroup_v_lst_vendorODBC.name AS vendor, "" AS LOCATION
FROM (QBReportAdminGroup_v_txn_po_line INNER JOIN QBReportAdminGroup_v_lst_item ON QBReportAdminGroup_v_txn_po_line.item_id = QBReportAdminGroup_v_lst_item.id) INNER JOIN QBReportAdminGroup_v_lst_vendorODBC ON QBReportAdminGroup_v_txn_po_line.vendor_id = QBReportAdminGroup_v_lst_vendorODBC.id;

View 2 Replies View Related

Query To Retrive All Orders Made Within The Last 7 Days

Apr 6, 2006

Hi, I wonder if any one could help me with what I think is a simple query.

I would just like to show all the orders thats have been made within the last 7 days.

So far I can retrieve all the orders made today, by using 'Date()' as my criteria, but cant figure out what criteria to use for the last 7 days. It would also be good, if i could figure out how to retrive all orders made within the last month, and as well select all orders made between two specific dates.

Regards

View 10 Replies View Related

Query Calculating No Of Days Between Start And End Date

Mar 20, 2007

i am trying to run a query from a form which will bring up the no of days difference between the start and end date also on the same form.
The query doesn't bring back any results can someone please guide in what i am doing wrong.
Here is the query
SELECT DateDiff('d',[start date],[end date]) AS [no of days]
FROM [booked property]
WHERE ((([booked property]![start date])=[forms]![booking]![booked property]![start date]) AND (([booked property]![end date])=[forms]![booking]![booked property]![end date]));

Thanks

View 2 Replies View Related

Days=NextDate-CurrentDate But How In Access Query?

Aug 8, 2007

I have two tables
ACCOUNTS
with fields
(AccountNumber, Name, AccountTypeID, Address, Phone, Date A/C Opened)

And
TRANSACTIONS
(TransactionID, TransactionDate, Particular, ChequeNo,AccountNumber,AccountTypeID, Rate, WithdrawalAmount, DepositAmount)

I created a query based on these two tables
CUSTOMER
(AccountNumber, TransactionDate, Days)

In this query Days: (NextTransactionDate-TransactionDate)
How I access NextTransactionDate of a specific Account in the record?

View 7 Replies View Related

Queries :: Merge All Days In One Row - Export Query To PDF

Dec 10, 2014

I have a query that as a result like the attachment below and I want to merge in this case all the days in one row, like also says in the pdf file!

Also there is anyway that the query exports it self to a pdf?

View 3 Replies View Related

Query Expression To Find Records 30 Days Past Due

Mar 22, 2005

I am trying to run a query to print invoices that are 30, 60, and 90 days past due. What expression do I use to search for records that were purchased 30, 60, 90 days prior? I was able to find the expression to add time for the due date but was unable to find the expression to subtract time for my search. Thanks for any help!! Beck

View 1 Replies View Related

Queries :: Building A Query To Pick Between Set Months / Days But Different

May 4, 2014

I am building a database with Access 2013. The information contains data built from a workplace violence report form. I have to build a query to pick the data but must fall between two different years.The data range must be from 09/01 previous year (ex. 2012) and 08/31 current year (ex. 2013).

As the database collects more information, the year range will change but the other information will stay the same (ex 09/01/2013 to 08/31/2014).I do not want to change the query annually, just let it change the year automatically.

View 1 Replies View Related







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