I have a table which has a start date and an end date on it: e.g. 25/10/06 to 3/11/06.
I want to set up a query to calculate the number of days between those two dates, but only for the month of October: so it would only come to 7 days (not 10 days).
How do I do this please??
Also: once I have the formula worked out, how can I write it so that a user can enter the month they want to query (e.g. october)?
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
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
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.
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?
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.
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.
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
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
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.....
I am in need of you help in calculating this. Basically, I don't want the code to count zero. For example, today is 3/19/2008 - Date() should equal = 1 and not zero..
Here's some more examples:[lastfollowup] being 3/18/08 Date() - [LastFollowup] = 2
Here's my code: DaysOpen: ((DateDiff("d",[LastFollowup],Date(),2))-(Int(DateDiff("d",[LastFollowup],Date(),2)/7))*2)+IIf(Weekday(Date(),2)>5,5-Weekday(Date(),2),0)+IIf(Weekday([LastFollowup],2)=6,1,0)-IIf(Weekday([LastFollowup],2)>Weekday(Date(),2),2,0)
Can anyone help I have one field that you enter a start date the next field is the start date that adds 28 days to give a due date but this includes saturdays and sundays which i dont want i only want the working week/day. Please help
1st Field is called Termination Date 2nd Field is called Due Date: 3rd Field is called Date Completed: 4th Field is called (+/-):
Termination Date = I enter a date such as 20/05/05 Due Date = Automatically fills in using the expression below 17/06/05 The Due Date has an expression builder i.e. Termination Notice-Due Date: [Termination Date]+28
Date Completed = I enter a data such as 18/06/05 (+/-) = Automatically fills in with -1
The problem is that Termination Notice-Due Date Automatically filled in using the above expression but it counts saturdays and sundays i dont want saturdays and sundays counted in the +28
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.
I have a table that has several fields however the ones I'm working with are Date, Letter, RollOff.
Date being the date the record was entered example 6/1/2006
Letter can be letter codes simply a,b,c,d,e etc
RollOff is 1 year from the Date the record was entered.
I've searched though several pages of dateadd info but haven't ran across an exact similar situation so far.
Getting the RollOff is no problem, simply DateAdd("yyyy",1, [Date]). However what I'm attempting to do is I need to add a certain amount of days to the calc between the date entered and the 1 year rolloff that match the Letter of "B".
Each record entered will only have 1 Letter and each entry is only for 1 day.
I'm thinking I will need a second query that will gather the sum of "B" codes to determine the amount of days needed to add to my DateAdd calc.
sample layout would be.
Date Letter RollOff 6/1/2006 A DateAdd("yyyy", 1, [Date]) + 3 days of B Codes for 6/2,3,4 6/2/2006 B 6/3/2006 B 6/4/2006 B 6/5/2006 C
Since 6/1/2006 RollOff is 1 year 6/1/2007 however since there was "B" enteries between the time the record was entered and the RollOff date the amount of days needed to be added so the RollOff would actually be 6/4/2007.
I have table with filed "entrydate" which has records of dates from 1 aug 06 to 10 aug 06. How to see the last 5 days result. like form 6 aug 06 to 10 aug 06
Note: I dont want the date to compare with current date date() because this is history data. also I hope to see the result with auto creteria I dont want to add the date in creteria filed manullly.
I recently ran into a problem calculating working days, i now have it working however i have a couple of other issues that i would like some assistance with. I am looking to introduce a seperate field which would say eitehr YEs or NO if the entry is more than 5 days old. SO i know how many are over 5 days. But whenever i use > 5 i get Data type mismatch. How do i get round this. :mad:
Hi All, i need ur help, i have working on database in which one of form/table i m using the day code(e.g 1 to 365). i want that these day value are automatically add on next day.......
For Example: Today Date: 17/08/2005 Day Code: 229 2nd Date: 18/08/2005 Day Code: 230 3rd Date: 19/08/2005 Day Code: 231
i just want when date chenge, day code is automatically chenged.
I need help sorting by InvoiceDate for the AgedReceivable form.
I have place 4 text fields in the footer of the subfrmStatements forms. The control source for each text field is =IIf(IsNull([InvoiceBalance]),0,Sum([InvoiceBalance])). I need help finishing the code.
The sub form shows only the records related to a specific customer that is selected on the main form. I would like to sort the InvoiceBalance by the InvoiceDate field with the following parameters:
0 – 30 days 31 – 60 days 61 – 90 days over 91 days