Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re: 181-483661 (Working Week)

Status
Not open for further replies.

Jembo

MIS
Dec 20, 2004
38
0
0
GB
First of all I must confess to little (if any) knowlwdge of VBA so i apologise in advance for my ignorance.

I have built a little utility using Access 2000, and all the automated functionality is controlled by macro's.

However, I need to create a report that macro's alone will not build, and I have found some code on this site (Thread 181-483661 Working Week) that on the surface looks to produce exactly (with a slight tweak) what I am trying to produce. I need to report out where a StartDate and EndDate are 5 or more days apart.

Presumably, (and this is where my ignoramce may be highlighted) I just need to ammend the last line of code to;

ElapsedBDays = (WeekDays - Holidays - 1) >= 5

? ? ?

So, I have the code but how do i use it? How do I 'call' the code to create a table/report? Obviously I need to include the code somehow into a make-table query on which I can base my report, but how do I go about this?
 
As it is written the function:

Function ElapsedBDays(ByVal StartDate As Variant, ByVal EndDate As Variant) As Integer

returns a number.

If you want it to return True Or False then you need to change the function declarative to :

Function ElapsedBDays(ByVal StartDate As Variant, ByVal EndDate As Variant) As Boolean

You should be able to use this function in any query just by adding a new column thus...

MoreThan5:ElapsedBDays(startdatefieldname,enddatefieldname)

using your own field names as indicated.



 
Thanks. Got that. I sort of figured it and am just now running a query and testing the data to make sure it gives me what it should.
Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top