Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3080
  • Last Modified:

NETWORKDAYS function returning a message of "Undefined function 'Networkdays' in expression"

I made a few attempts and then dumbed it down to a query as simple as networkdays(#3/1/2005#,3/15/2005#), but the same error pops up.  The function does not even seem to be recognized.  I searched through a few related questions on the web site and made note of the required add in driver title MSOWCF.DLL, which I do have in the proper directory.  Does anyone have any suggestions or should I have my boss hire a chimp with a learning disability as a suitable replacement?
0
mbilicic
Asked:
mbilicic
  • 5
  • 3
  • 2
  • +2
2 Solutions
 
ArjiCommented:
Is this an Access Project or Database?  Are you trying to use a VBA function in a SQL server query?  That is the error I received when I attempted to do this during an upgrade.  If so, you will need to duplicate the function in SQL server and not use a VBA function.
0
 
cstahlbergCommented:
Is your function a public function in a module, or is it private?
0
 
shanesuebsahakarnCommented:
Consider these as an alternative:
http://www.mvps.org/access/datetime/date0006.htm
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Rey Obrero (Capricorn1)Commented:
you need to add to your references

Tools>References
Microsoft Office Web Components Function Library

then do a
debug>compile
0
 
mbilicicAuthor Commented:
ARJI - I am using a database and thought it would be as simple as writing the expression in a field much life you would an IIF, LEFT, SUM, etc.. expression.  Is my only alternative then SQL?


CSTAHLBERG - it is definitley not a module and I am unsure of the "private" definition.  I only use the standard objects in Access - tables, queries, forms, and macros - not sharp enough to use the more powerful functions.
0
 
ArjiCommented:
If you are using a database, all you VBA functions should working in query.  Can you tell us specifically what function you are using?  The standard expressions like IIF, Left, etc should work just fine in a database query.  I tend to create a VBA function that does the same thing and then use that function in the query criteria(Myfunction()).
0
 
Rey Obrero (Capricorn1)Commented:
mbilicic ,
did you check if you have
Microsoft Office Web Components Function Library

in your references?
0
 
mbilicicAuthor Commented:
ARJI - I am too stupid to understand, let alone use VBA code, thus why the object orientation of MS Access is so attractive.  How about a little detail behind the issue:

The project is to gauge employee performance in a credit underwriting environment.  Underwriter performance is based on an individuals ability to complete the underwriting process in 10 days.  An Oracle-based application tracking log allows the underwriter to enter his/her start date and then the subsequent completion date.  I access the tracking log using an ODBC in MS Access.  The start date is called "DATECREATED" the completion date is called "DATECOMPLETED".

As an example, an underwriter named John Smith begins a deal on 3/1/2005 and completes the deal on 3/10/2005.  John Smith is one of 100+ other underwritiers doing the same thing.  What I need to determine, in an automated fashion, is that John Smith completed his deal in 8 business days or 2 days under the goal.  [the difference between 3/1/2005 and 3/10/2005, excluidng weekends]

Based on the MS Access help file all I would need to do in a query hitting the linked tracking log [via ODBC] is create a new query and in the field write an expression like:  NETWORKINGDAYS([DATEDCREATED],[DATECOMPLETED]).

This seemingly simple formula, based on the MS Access Help file, should return a value of 8 working days.  What is wrong with my logic?
0
 
mbilicicAuthor Commented:
CAPRICORN1 - Can you tell me how best to ascertain if I have the "Microsoft Office Web Components Function Library"?
0
 
cstahlbergCommented:
mbilic,

You function NETWORKDAYS is not a predefined funciton in access.  I was looking and it turns out this is a function in Excel under the Analysis add-in.  However, Access doesn't understand what it is.  You can get access to understand NETWORKDAYS however, by referring to the proper object library.  If you go to your Tools menu and choose Macro->Visual Basic Editor, you will go into VBA.  Here is where you can set up the refernce to the MSOWCF.DLL by going to the tools menu and choosing References.  You should be able to find the "Microsoft OfficeWeb Components Function Library" in the list of libraries.  Make sure this is checked off.  If it isn't there, you're going to have to install it.

0
 
Rey Obrero (Capricorn1)Commented:
mbilicic
from the VBA window

Tools>References
look for  
Microsoft Office Web Components Function Library
and check the tick box Click OK

then click
Debug>Compile

you should be free from NetworkDays error, if there are other errors correct them

what version of access are you using?
0
 
Rey Obrero (Capricorn1)Commented:
also check if your function is the similar to this

Function GetNetWorkDays(startDate As Date, endDate As Date) As Integer

Dim objFunction As MSOWCFLib.OCATP
Set objFunction = New MSOWCFLib.OCATP
GetNetWorkDays = objFunction.NetworkDays(startDate, endDate)
Set objFunction = Nothing
End Function
0
 
Rey Obrero (Capricorn1)Commented:
mbilicic
did you get your function working?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now