No, you don't need to change anything in that function, and yes, the object
should be (General) and the Procedure Work_Days
It's possible that your references are probably messed up.
This can be caused by differences in either the location or file version of
certain files between the machine where the application was developed, and
where it's being run (or the file missing completely from the target
machine). Such differences are common when new software is installed.
On the machine(s) where it's not working, open any code module (or open the
Debug Window, using Ctrl-G, provided you haven't selected the "keep debug
window on top" option). Select Tools | References from the menu bar. Examine
all of the selected references.
If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.
If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)
For far more than you could ever want to know about this problem, check out
http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html
Your [To A/E] and [From A/E] fields ARE dates, aren't they?
--
Doug Steele, Microsoft Access MVP
(No private e-mails, please)
Max said:
Sorry I keep addressing this, but I am still having
problems. After creating the module and changing my code,
I get an error highlighting the following line.
BegDate = DateValue(BegDate)
Am I to change or replace the variants? Do I replace
BegDate and EndDate with [To A/E] and [From A/E]? It is
almost there...just missing something. Also when creating
the module the Object is (General) and the Procedure is
Work_Days...is this correct?
Many Many thanks
Max
-----Original Message-----
Copy the code from
http://www.mvps.org/access/datetime/date0006.htm into a
module (and make sure you don't name the module Work_Days).
Change your code to
=IIf(IsNull([From A/E]),Work_Days(Date(),[To A/E]),Work_Days([From A/E],[To
A/E]))
--
Doug Steele, Microsoft Access MVP
(No private e-mails, please)
Thanks, however I am a bit confused on how to apply a
function to a control source....
max
-----Original Message-----
Take a look at the Date section of "The Access Web"
http://www.mvps.org/access/
--
Doug Steele, Microsoft Access MVP
(No private e-mails, please)
Hello all,
I have an expression calculating the number of days
between two dates. This also takes in account if one
date
is null. What I forgot to put in the mix was to
calculate
the days excluding Saturday and Sunday.
Here is the expression.
=IIf(IsNull([From A/E]),Date()-[To A/E],[From A/E]- [To
A/E])
Any ideas...?
Many thanks,
Max
.
.