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

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

Creating Archive Table For 30 Days To Contain All Data Imported From Multiple Text Files?

Oct 30, 2014

i'm in the process of creating an Access database to import data in text files and then export the data as fixed width text files, this is now working fine

My next step is to be able to setup an "Archive" Table which will hold all the data i have imported across multiple import proceudres for the last 30 days, i then want to be able to "De-Dupe" any files i import against this to ensure i never load duplicate data.

View 1 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

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

Showing Null Values When Calculating Days Passed?

Feb 24, 2012

I am using workdays to calculate time passed between two dates. I also have a table for Holidays that I don't want counted as work days. This is working well, but I would like my queries to show a null value instead of showing #Error when a date field is empty. Here is my coding in my Module.

Option Compare Database
Option Explicit
Public Function Workdays(ByRef startDate As Date, _
ByRef endDate As Date, _
Optional ByVal strHolidays As String = "Holidays" _
) As Integer

[code]....

View 3 Replies View Related

Queries :: Consecutive Days Worked?

Sep 19, 2013

I have a table of employees, and dates they worked on. These are seasonal employees who want to get in as many days as possible before the season ends, but regulation states they must take a compulsory rest day after x days.So I need to create a query that can return the list of employees, with a count of consecutive workdays up until current date.

If today is 20/09/2013, and Johnny worked on, 19, 18, 17, 15, 14, 13, his count must be 3, because he was absent on 16. Therefore only from 17 through 19 is regarded as consecutive.

If Peter worked 19, 18, 17, 16, 15, 14, 13, his count would be 7, because unlike Johnny, Peter still worked on 16.

View 12 Replies View Related

Queries :: Next 7 Days From Calculated Date Value

Aug 4, 2013

In a query i have setup, i work out when a tenant is next due to pay their rent.

Looks like this

Tenant Last Payment Date Payment Terms Next Payment Date
User1 01/07/13 Monthly 01/08/13
User2 01/07/13 Weekly 07/07/13

The next payment date is calculated using an IF statement and DateAdd in the query, so if it is weekly it adds 7 days, if it is monthly it adds 1 month.

What i am trying to do is write sub query of this one which shows which tenants are due to pay within the next 7 days.

But the access query seems to ignore the criteria I'm putting in....in the next payment date criteria i have tried specifying >Now() + 7 or >Date() +7 but neither seem to work, it just shows up every record...

View 6 Replies View Related

Queries :: How To Select Records When Date Is Less Than 30 Days Apart

Mar 10, 2014

I have a large database filled with customer records. Some customers come one time. Other customers come 50 times at year. I want to find all customers that have records that are less than 30 days apart so I can ultimately see the types of products they buy. How do I write the query?

I attached a picture of a sample database. The 30 day (+/-) field doesn't exist but I would like the query results to build it.

View 11 Replies View Related

Queries :: Calculating Years / Months And Days

Aug 6, 2014

I'm trying to breakdown a date into years, months, and days. Simple right?

The code I've been using for months returns a negative month if it happens to be the next month. Instead of returning 1 Year, 1 Month, 23 Days, it will instead return 1 Year, -1 Month, 23 Days.

Code is:

Code:
Months: IIf(IsNull([TIR]),0,IIf(Day([TIR])<=Day(Date()),DateDiff("m",[TIR],Date())-[Years]*12,DateDiff("m",[TIR],Date())-[Years]*12-1))

View 4 Replies View Related

Queries :: Return Selected Date Plus Next Three Days

Mar 22, 2015

Ok, so I'm sure this is a pretty simple criteria, but I just can't seem to get the syntax right.

I'm trying to allow my user to select any start date and the query will return that date plus the next three days.

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

Queries :: Using Working Days In Search Criteria

Apr 22, 2013

I have a query where I use the search criteria of =Date()+1.

However I really need this to add on a working day (i.e. excluding weekends).

Is there an easy way to do this?

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 :: Display Expiration Dates For Next 30 Days

Nov 13, 2014

My database keeps track of training for employees, some of which expires after a period of time, which is in the tables. I need to create a query that displays only the employees and the training that expires during the next 30 days. I have a query that displays the expiration date (this field uses DateAdd and adds the expiration term to the date the employee completed the training) I am trying to add a criteria to this field. I found <=Date()+30 in my searches but that displays all of the records from 12/14 and back. I have tried all kinds of versions of this (obviously, not the correct one) and either get all records or none. (Yes there are records in the database that fall within the the period I am trying to display - that is something that I have been known to forget)

Is it because I am using criteria in a field that is based on DateAdd or what would be the correct criteria for this?

View 3 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 :: Using (days) Droplist As Criteria Against Daysdiff Expression?

May 27, 2013

I have a query that uses two criteria from a user input form. On the form, the user would input a customers last name and use a dropdown list (based on a table 30,60,90,120,365 days) to select how many days previous they want to search. Unfortunately there is something that I'm over looking and can't figure out.

Let's say I have multiple records that match the following criteria: Last name "James", days since contracted all less than 30 days. For some reason when I put in "James" as the last name in my form and select "30" from the droplist, it only lists the most current one which is zero days. Even if I select "60" from the droplist, it still only shows the zero day contract.

If I go back and select "90" from the droplist is brings up 3 - 3 day old contracts and my 1 zero day old contract. If I select 120, it picks up another contract that is 4 days old. If I select 365 it picks up a couple more, but still not everything. Here is my SQL code.

Code:
SELECT tblAllData.[F&I Manager], tblAllData.[Reviewing BOA], tblAllData.Date,
tblAllData.[Stock#], tblAllData.[Deal Date], tblAllData.[Cust First Name], tblAllData.[Cust Last Name],
Round(DateDiff("d",[deal date],Now()))/1 AS Days, tblAllData.[Bank Name],

[Code] ....

View 2 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 :: Calculating Days Between Dates From A Specific Record

Dec 14, 2013

I have a query that records a status update, and the date it was made by an employee etc. The table has a secondary key related to ... lets say a project table.

E.g.
Status Id; EmployeeID;ProjectsID;Status;Date

I want to calculate the average amount of days it takes for a status change occur.

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