Thread: Undefined Function
01-21-15, 14:53 #1Registered User
- 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
StartDate = StartDate + 1
WorkingDays = Count
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];
01-23-15, 19:04 #2Moderator
Provided Answers: 19
- Join Date
- Jun 2005
- Richmond, Virginia USA
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 foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007