Hi Folks,
I've been reading these forums for a while and now I'm in desperate need of help, so I thought I'd post!
Background:
I'm creating a Service Dashboard to track my team's adherence to Service Levels. As part of this, I've set up a web page which pulls data from a query in Access 2003. The page shows which tickets we're working on, how long they've been open, the service level for each ticket etc.
Since we're a 9-5, Monday to Friday support setup, I'm using a module that I found online to calculate how long a ticket has been open in Business Days (code below). This works perfectly from within Access. However, when I try to load up the web page from IE, I get two errors: "Data provider failed while executing a provider command" followed by "Undefined function 'WorkingDays' in expression."
I've got my function called WorkingDays in a module named "modWorkingDays ".
I've been looking everywhere for a solution, and can't seem to find one. I read something about certain functions not being visible from outside Access, but I don't know if this is the case. To test it, I tried using an example from the Visual Basic Language Developer's Handbook - it calculates Working Days in a completely different way. However, when I use this alternate code and open the web page, I get the same error.
I haven't posted the SQL query code as it's really messy (I have a very long IIF statement in one of my query columns), but it looks normal - the only thing I notice is that the function WorkingDays is in there, but there's no reference as to where the function is located. Is this normal (ie. SELECT WorkingDays(... iif statement...) AS DashPriority FROM etc. etc.
Any thoughts at all would be helpful at this point... I'm at a point where I've tried everything I can think of, and nothing is helping.
I've been reading these forums for a while and now I'm in desperate need of help, so I thought I'd post!
Background:
I'm creating a Service Dashboard to track my team's adherence to Service Levels. As part of this, I've set up a web page which pulls data from a query in Access 2003. The page shows which tickets we're working on, how long they've been open, the service level for each ticket etc.
Since we're a 9-5, Monday to Friday support setup, I'm using a module that I found online to calculate how long a ticket has been open in Business Days (code below). This works perfectly from within Access. However, when I try to load up the web page from IE, I get two errors: "Data provider failed while executing a provider command" followed by "Undefined function 'WorkingDays' in expression."
I've got my function called WorkingDays in a module named "modWorkingDays ".
I've been looking everywhere for a solution, and can't seem to find one. I read something about certain functions not being visible from outside Access, but I don't know if this is the case. To test it, I tried using an example from the Visual Basic Language Developer's Handbook - it calculates Working Days in a completely different way. However, when I use this alternate code and open the web page, I get the same error.
I haven't posted the SQL query code as it's really messy (I have a very long IIF statement in one of my query columns), but it looks normal - the only thing I notice is that the function WorkingDays is in there, but there's no reference as to where the function is located. Is this normal (ie. SELECT WorkingDays(... iif statement...) AS DashPriority FROM etc. etc.
Any thoughts at all would be helpful at this point... I'm at a point where I've tried everything I can think of, and nothing is helping.
Code:
Public Function WorkingDays(StartDate As Date, EndDate As Date) As Integer
'....................................................................
' Name: WorkingDays
' Inputs: StartDate As Date
' EndDate As Date
' Returns: Integer
' Author: Arvin Meyer
' Date: May 5,2002
' Comment: Accepts two dates and returns the number of weekdays between them
' Note that this function has been modified to account for holidays. It requires a table
' named tblHolidays with a field named HolidayDate.
'....................................................................
On Error GoTo Err_WorkingDays
Dim intCount As Integer
Dim rst As DAO.Recordset
Dim DB As DAO.Database
Set DB = CurrentDb
Set rst = DB.OpenRecordset("SELECT [HolidayDate] FROM tblHolidays", dbOpenSnapshot)
StartDate = StartDate + 1
'To count StartDate as the 1st day comment out the line above
intCount = 0
Do While StartDate <= EndDate
rst.FindFirst "[HolidayDate] = #" & StartDate & "#"
If Weekday(StartDate) <> vbSunday And Weekday(StartDate) <> vbSaturday Then
If rst.NoMatch Then intCount = intCount + 1
End If
StartDate = StartDate + 1
Loop
WorkingDays = intCount
Exit_WorkingDays:
Exit Function
Err_WorkingDays:
Select Case Err
Case Else
MsgBox Err.Description
Resume Exit_WorkingDays
End Select
End Function
Comment