Calculate Business Days Through MS Access Events (VBA)

I need to calculate the number of business days from dates inputted from a form. Does anyone have VBA routine that does this or know how to accomplish this

Sponsored Links:

Related Topics

Calculating an end date from business days
I have a form (frmTransferInAging) where the user inputs a value for business days (eg 10) into txtBusDays. The value is used by a query to determine 10 business days from today - For example, if 10 was entered today I want to calculate 10 business days before today - how do I calculate this date?

I am currently using the following criteria in the query which returns calendar days:
<=(Date()-([Forms]![frmTransferInAging]![txtBusDays]))

I believe I can create a function to call from the query


Net Work Days in Access
In Excel, I frequently use the formula, Networkdays, to calculate the number of business days that it has taken someone to process an order. I was wondering if there is a way to do the same thing in Access? I have a Project Received Date field and a Project Released Date field. I would like to calculate the business days between these two dates (please note, some of them may cross years (i.e. the project was received 12/28/2011 and released 1/5/2012). Is this possible, or should I stick to doing the calculation in Excel


Rucurring Calendar
I need to build a database that will build a calendar for each account. This calendar will be a recurring calendar. The recurrences could be anywhere from monthly to weekly to every 3rdTuesday to the 4th calendar or the 4th business day.

Now it gets a little trickier. Each Account has 4 monthly events that need the calendar built. The first event date is set by specifying the calendar rule. Each other event is then set based on the other events. For example, we'll call each event by numbers 1 - 4.
Event 1 is set to pay on the 15th of the month. Then the 2nd event pays on Thursday at least 3 business days past Event 1. Event 3 pays 4 business days prior to event 1. And Event 4 pays 15 days prior to event 2.

See what I mean by a little complex?


IIf Date Query
This is in Access 2010 and I am adding days to a date based on a certain day of the week. Sun, Mon, Tue, Wed would add 9 days and that portion works fine. When I add the next part forThu, Fri and Sat it gives me a -1 result for all days.

Sun, Mon, Tue, Wed needs to calculate or add 9 days to Date
Thu, Fri need to calculate or add 11 days to Date
Sat need to calculate or add 10 days to date

This is a database to calculate the expiration day after 7 working days from a specific date.


CRITERIA only looks at the LAST 20 BUSINESS DAYS
I have a query that subtracts two columns. One column is the Date with most recent data, the second column is the date when the data was requested. I want to subtract the date of the request from the date of the most recent data, and if this number is more than 4 BUSINESS DAYS, then to show up in the query.

I can get the query to calculate this, but it includes saturday and sunday in the calculation


calculate no. of working days
First of all Im sorry for my English. Im an a rockie in access and Im like to question the forum about how I can create a date function than calculate the amount of working days between dates (startdate and endate) after take into account the banking holidays that are previously introduced in a table.


How to calculate how many days outstanding
In Access 2007 I have a report that I want to calculate how many days since we received and item and print that number. I selected build event, then Expression Builder, the rest is Date()-[Commercial]![Date Rcvd]=Sum

The only thing that prints for that column is #Days. I'm not well versed in Access, but if anyone has some quick pointers. I want it to be today's date less Date Rcvd column field in our database.


Calculating number of days from input.
How do you calculate the number of days from the original date the the record was recorded.

for example

You have a text box the has three options 90 day, 180 days, and 360 days. And a date and time box to true to show the expiration date.

How do I get the database to show the to calculate the expiration date depending on the number of days that was selected.


Access events
We can trigger VBA code on form events. Can we trigger them on Access application events? For example, can I trigger some vba code when I run a query? Reason I ask is that when I'm running a rather lengthy query, I really cant do much but sit there and wait for it to finish. It makes me look rather unproductive to those who walk by and don't know what's really going on. It doesn't help that Access' progress bar might as well not exist, as it is totally inaccurate. What I want to do is have a from with with a progress bar, more so like the windows start-up bar that shows that scrolls constantly rather than showing how much is done, every time I run a query.

It brings up the larger question of using Access events, rather than form events, to trigger code. Can this be done


Function in Query
I have a query where I have a field NormalDays and SickDays. I want to calculate if someone has Less than 26 days than it will take rest days from SickDays like below

NormalDays = 24
SickDays = 4
I put function like IIF([NormalDays]<26,[NormalDays]+[SickDays],[NormalDays])
But in this case I want query to calculate only 26 days if someone works for 24 days + 3 SickDays my function will say 27 days but I want to give him only 26 days not more than that.
Is there any way out to fix this problem? Please advice


IIF statement to calculate days open
I am trying to write an IIF statement to calculate the days a report has been open. I have to do this because in the database I am linking, the start date gets changed too easily, so I have to calculate the days open this way: DAYS_OPEN: (Date()-([prob_eval_orig_due_dte_tm]-30)) The database automatically assigns a 30 day due date. However now I have some reports due in 45 days. I need to modify my query to say if [cause_type_cd] is equal to "RC" use 45 instead of 30 otherwise use 30 in the days open calc. I assume I could do this in an IIF statement but I am not very good at these. Below is my stab at it but I get syntax error.

DAYS_OPEN: IIf([cause_type_cd]=[RC],(Date()-([prob_eval_orig_due_dte_tm]-45),Date()-([prob_eval_orig_due_dte_tm


Excel workday function
I need a way to match individual persons number to the grid listing their specific holidays off, and then return to me the date x number of business days later.

In excel I would simply go workday(starting date, number of days, holiday dates)= datedue

All the access solutions I have seen have a table of generic holidays, but nothing specific to a particular person. I need it to only calculate using the individualised holidays.

I can either have the holidays in a separate table or in a column in the employee table - I am not picky either way.


If ..Then...Else
As an Access Newbie, I cant seem to get a function? to do the following.
Two tables, one with a list of constants (Dates and events) and the other with details of events within which a field looks up the constants if the events are equal and adds a declared number of days to present the expected delivery date.
This is what I mean.

If Table 1. event=Table 2 .event then Date/Event table 1 +10 What rubbish you say.
I would prefer code, but my ignorance limits me.


Can I calculate cost of production?
Im not sure if I should use access or another more suitable software to calculate costs of production for my business. I have a list of 50 products, each product is made by aprox 5 materials, plus manufacturing costs like energy, transportation, packaging, etc. I need a program that can tell me the costs of the products I need at the moment and that can calculate in real time and adjust cost depending on updated prices. Is access a good idea for this


Days in part of the month
If I have a date ('VisitDate')then if I need to know how many days in that particular month from that given date,

Day(DateSerial(Year([VisitDate]), Month([VisitDate]) + 1, 0))

If I need to calculate the number of days in that month before the visit date, how will I write a straight forward VBA code like the one above?


Calculate date Range 2 seperate tables
This seemed like a really easy thing to do when I started, but after looking at the forums, most of the replys seem to be using VBA to calculate, or else I am searching in the wrong spot :-\

I need to query or use a report to provide the number of days elapsed since the Start date and the Finish date in two different tables.

Both tables are linked to the Primary table via one to many


Have function to calculate work days, what do I do with it?
I am trying to set up a billing system for reservations and need to calculate the number of work days between my reservation dates. I got the code for a function off the microsoft website,

Would it make sense to have a textbox that would populate a "Workdays" field in my reservation table, and then use that field in a query to calculate the reservation cost? Or do I even need to store the workdays value? Maybe on the after update event for Dateout and DateIn fields on my form?


Calculate date
I want to calculate total number of days within each FID_.


access data macros
I have a data macro tied to a before change event that sets the noticetype field to "30 days late" if the dayslate field is greater than or equal to 30 days and less than 60 days and thensimilar notices for 6o days and 90 days.

It works fine as along as I use the before change event
It seems more logical to use the after update event or even after insert event but when I choose an If Field in those events I can't seem to get the setfield option to appear even when I try and choose it on the right side of the screen. Am I missing something?

Also I have a field called todaysdate that automatically pulls the system date by using the default Date()


Date within period of time
Working on a history database I have a Table which comprises eventID EventName StartDate and EndDate fields. An event might likely be the duration of a term of office, i.e. a matter of years, as much as a three day battle. The purpose of the query is to insert a date which will draw up all events occurring on that date whatever their duration, i.e. a perfect cross-section of what was going on.
I did my best ending up with
SELECT Events.EventID, Events.EventName, Events.StartDate, Events.EndDate
FROM Events
WHERE (((Events.StartDate)>=[date]) AND ((Events.EndDate)<=[date]));
But it does not work. Please can you advise. (I am running Access