Sam said:
Dirk
I have read this thread and found it to be most useful! I too had a
problem with eliminating weekends and after reading this thread have
worked out what I was going wrong (Thanks Heaps)
I do however have a problem with this code calculating the number of
days when a date field is left blank. I will expand on this:-
I have seven date fields in my data base. When a user places the file
into a differnet status, it auto records a date in one of these
fields based on a calculation between the data data entered and the
date the file was placed in the status. I have created a query based
on these tables.
There are occasions where some or all of these fields will not need
to have a date inserted (actually these would be at least one that
would be populated) Where there is no date populated I get "#Error"
where the date field is blank.
How can I overcome this problem?? Should I set up the table to
default a zero (0) in the field so that in the event that there is no
Data a 0 is listed or is there a way to adapt the code below to
compensate for this?
I hope my explanantion has not confused you, however if I have not
explained myself correctly, I will gladly expand on this if need be.
Hi, Sam. Sorry I didn't see this message right away; it was hiding at
the bottom of my list because you tacked it onto an old thread.
I think your problem will probably be solved fairly easily, but
unfortunately, I don't think I have quite enough information to do it
yet. Where do you get the #Error value? I assume this is happening in
one or more calculated controls. What are the controlsource expressions
in those controls? For that matter, why don't you list all the controls
involved, give the controlsource of each (whether bound or calculated),
and note which ones give you #Error under which circumstances?
Please also post the code of the exact version of the function that
you're using. That'll help if it comes down to modifying the function.
Given that the #Error occurs because one of the required dates is
missing, what would you want to have displayed in the calculated field?
It would make sense for it to be blank (Null), but maybe you want to
assume some value for the missing date field(s), such that you can still
calculate a value for the work days.