Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2015

    Unanswered: Undefined Function

    I have a VBA function defined in Access that I call up in an Access query. The query runs perfectly when run locally on my PC. That said, when I attempt to run that same query on a web page I get an error that the function is undefined. I have used several other similar functions, all of which work fine when launched locally. But when accessed through a web page they too fail for the same reason.

    Option Compare Database

    Public Function WorkingDays(StartDate As Date, EndDate As Date) As Integer
    'Return number of working days between two dates
    Dim Count As Integer

    StartDate = StartDate + 1 'Don't count the first day!

    Count = Int((EndDate - StartDate) / 7) 'number of whole weeks
    StartDate = StartDate + (Count * 7)
    Count = Count * 5
    Do While StartDate <= EndDate
    Select Case Weekday(StartDate)
    Case 2 To 6 'Mon - Fri
    Count = Count + 1
    End Select
    StartDate = StartDate + 1
    WorkingDays = Count

    End Function

    SELECT Lead_Source_From_To.Leads_From, Lead_Source_From_To.Leads_To, ([WorkdaysCalc]/5)*30 AS Goal, WorkingDays([Leads_From],[Leads_To]) AS WorkDaysCalc
    FROM Lead_Source_From_To, [ACT04-Month-Difference];

  2. #2
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    I believe you'll find that MS Access web apps have to be designed using Macros, as VBA is not supported.

    Linq ;0)>
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts