Results 1 to 6 of 6
  1. #1
    khughes46 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Grapevine, TX
    Posts
    231

    Can;t get Workdays function to work

    Granted I am new at trying to use VBA but I followed the instructions explicitly when copying the code into a module. I don't know if I didn't name it correctly or what, but I got a clean compile. However when I try to use the Workdays function I get an error "Undefined function Workdays in expression. What have I done wrong? File attached.
    Attached Files Attached Files

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Do the Function and the Module have DIFFERENT names? They should and it's important.

  3. #3
    khughes46 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Grapevine, TX
    Posts
    231
    They do now, the function is Workdays and the module is Work_Days.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    That should have resolved your issue. Did It?

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    The names are different. You are calling the Workdays module and not the Weekdays() function in the query. Change WorkDays( to Weekdays(.

    I REALLY find query input popups annoying. Better to use reference to controls on form as input. Even better is no dynamic parameters in query at all (I don't use them). I use code to apply filter criteria to form or report when they open.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    khughes46 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Grapevine, TX
    Posts
    231
    That did it. Thanks.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. MaxLocksPerFile Error with Workdays Function
    By sandykj3 in forum Modules
    Replies: 2
    Last Post: 12-10-2014, 04:07 PM
  2. Function to Determine Number of Workdays Error
    By McArthurGDM in forum Modules
    Replies: 3
    Last Post: 12-08-2014, 02:51 PM
  3. Help with Workdays function (VBA) from Microsoft website
    By GregTheSquarePeg in forum Programming
    Replies: 14
    Last Post: 12-04-2013, 01:50 PM
  4. DateAdd function for workdays?
    By 10 Gauge in forum Programming
    Replies: 2
    Last Post: 04-06-2011, 09:20 AM
  5. Can't get NZ Function to Work
    By Xiaoding in forum Queries
    Replies: 6
    Last Post: 04-14-2010, 09:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums