Calculate business days

A

Amin

Hi, i know this has been asked and answered before, but while my knowledge of
SQL and queries has gotten much better, I'm still very new to VBA. I also
have looked over Doug Steele's September Access file, and while it is very
good, I think I'm still misunderstanding a fundamental aspect of this.

I'm trying to calculate the number of business days between two dates. I
have a table called Holidays, and a field called Holidaydate. I am using the
code given in this link:

http://www.mvps.org/access/datetime/date0006.htm

So I have a form with two textbox's called "StartDate" and "EndDate". I
guess I also need a textbox called "Days", where the calculation is inputted.
I have created a module called "Workingdays2", where I pasted the code in the
above link. But frankly, I don't know what the next step is to run the
application. I guess I need a command button that calculates the difference
in "StartDate" and "EndDate" and populates it in the "Days" box. My goal is
to use this calculated number of working days to divide the total workloads
by each member of my team to find their average workload per day.

I would appreciate any points in the right direction.

Thanks,
Amin
 
G

Graham Mandeno

Hi Amin

Set the ControlSource of your "Days" textbox to:
=WorkingDays2( [StartDate], [EndDate] )

Then the calculation will happen automatically as the dates in those two
textboxes change.
 
A

Amin

Success!

I had to change the name of my module, but that worked perfectly!


Graham Mandeno said:
Hi Amin

Set the ControlSource of your "Days" textbox to:
=WorkingDays2( [StartDate], [EndDate] )

Then the calculation will happen automatically as the dates in those two
textboxes change.

--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Amin said:
Hi, i know this has been asked and answered before, but while my knowledge
of
SQL and queries has gotten much better, I'm still very new to VBA. I also
have looked over Doug Steele's September Access file, and while it is very
good, I think I'm still misunderstanding a fundamental aspect of this.

I'm trying to calculate the number of business days between two dates. I
have a table called Holidays, and a field called Holidaydate. I am using
the
code given in this link:

http://www.mvps.org/access/datetime/date0006.htm

So I have a form with two textbox's called "StartDate" and "EndDate". I
guess I also need a textbox called "Days", where the calculation is
inputted.
I have created a module called "Workingdays2", where I pasted the code in
the
above link. But frankly, I don't know what the next step is to run the
application. I guess I need a command button that calculates the
difference
in "StartDate" and "EndDate" and populates it in the "Days" box. My goal
is
to use this calculated number of working days to divide the total
workloads
by each member of my team to find their average workload per day.

I would appreciate any points in the right direction.

Thanks,
Amin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top