?
Solved

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

Posted on 2005-03-28
13
Medium Priority
?
3,071 Views
Last Modified: 2008-01-09
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
Comment
Question by:mbilicic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +2
13 Comments
 
LVL 17

Expert Comment

by:Arji
ID: 13647456
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
 
LVL 3

Expert Comment

by:cstahlberg
ID: 13647525
Is your function a public function in a module, or is it private?
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 13648648
Consider these as an alternative:
http://www.mvps.org/access/datetime/date0006.htm
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 13648704
you need to add to your references

Tools>References
Microsoft Office Web Components Function Library

then do a
debug>compile
0
 

Author Comment

by:mbilicic
ID: 13652534
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
 
LVL 17

Expert Comment

by:Arji
ID: 13654700
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 13654774
mbilicic ,
did you check if you have
Microsoft Office Web Components Function Library

in your references?
0
 

Author Comment

by:mbilicic
ID: 13663166
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
 

Author Comment

by:mbilicic
ID: 13663182
CAPRICORN1 - Can you tell me how best to ascertain if I have the "Microsoft Office Web Components Function Library"?
0
 
LVL 3

Assisted Solution

by:cstahlberg
cstahlberg earned 750 total points
ID: 13663326
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 13663785
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
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 750 total points
ID: 13663825
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 13698257
mbilicic
did you get your function working?
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question