473,757 Members | 2,320 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"Undefined Function ... In Expression"

2 New Member
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.



Expand|Select|Wrap|Line Numbers
  1. Public Function WorkingDays(StartDate As Date, EndDate As Date) As Integer
  2. '....................................................................
  3. ' Name: WorkingDays
  4. ' Inputs: StartDate As Date
  5. ' EndDate As Date
  6. ' Returns: Integer
  7. ' Author: Arvin Meyer
  8. ' Date: May 5,2002
  9. ' Comment: Accepts two dates and returns the number of weekdays between them
  10. ' Note that this function has been modified to account for holidays. It requires a table
  11. ' named tblHolidays with a field named HolidayDate.
  12. '....................................................................
  13. On Error GoTo Err_WorkingDays
  14.  
  15. Dim intCount As Integer
  16. Dim rst As DAO.Recordset
  17. Dim DB As DAO.Database
  18.  
  19. Set DB = CurrentDb
  20. Set rst = DB.OpenRecordset("SELECT [HolidayDate] FROM tblHolidays", dbOpenSnapshot)
  21.  
  22. StartDate = StartDate + 1
  23. 'To count StartDate as the 1st day comment out the line above
  24.  
  25. intCount = 0
  26.  
  27. Do While StartDate <= EndDate
  28.  
  29. rst.FindFirst "[HolidayDate] = #" & StartDate & "#"
  30. If Weekday(StartDate) <> vbSunday And Weekday(StartDate) <> vbSaturday Then
  31. If rst.NoMatch Then intCount = intCount + 1
  32. End If
  33.  
  34. StartDate = StartDate + 1
  35.  
  36. Loop
  37.  
  38. WorkingDays = intCount
  39.  
  40. Exit_WorkingDays:
  41. Exit Function
  42.  
  43. Err_WorkingDays:
  44. Select Case Err
  45.  
  46. Case Else
  47. MsgBox Err.Description
  48. Resume Exit_WorkingDays
  49. End Select
  50.  
  51. End Function
Feb 28 '08 #1
2 5062
jeffstl
432 Recognized Expert Contributor
I am confused on the web page part of this.

Are you saying that your web page is strictly an HTML table that is exported from access?

Are you saying you are seeing these errors on the web page or inside access?

What kind of page is it that is loading? .asp? .aspx? .htm?

I will say that if you are trying to run this code by simply pasting it into an HTML document its not going to work like it does in access. Hope I'm not overstepping my assumption by saying this, but it kind of sounds like thats what your saying in your post.
Feb 28 '08 #2
rmmahara
2 New Member
Hi - thanks for replying!

Let's see if I can explain it better this time...

I've got an Access .mdb file. In the database, I've got a few linked tables - these are linked to an SQL database. I've got some queries that pull data from these tables into a usable format.

I want this data to be accessable through web pages, so I created a few Data Access Pages, using these queries as the source material. This works fine - I can load the .htm pages and see all the data in real-time. However, the data that is shown isn't correct, because I need to show business days, rather than linear days. This is where the code comes in.

Back in Access - I used the above code as a module. In my query, I call this function in order to calculate the number of Business Days between two dates. This works fine within Access, and gives me the right numbers. However, when I build a Data Access Page based on this new query (with the function call in the query), it looks fine within Access, but once I try to load the .htm page in IE, I get the error within IE.

So, to sum up:

Database: MS Access 2002
Data Source: Linked table, SQL Server
Function: Within Access, used in Access query
DAP: .htm file, calling data from Access query

Does that help?



I am confused on the web page part of this.

Are you saying that your web page is strictly an HTML table that is exported from access?

Are you saying you are seeing these errors on the web page or inside access?

What kind of page is it that is loading? .asp? .aspx? .htm?

I will say that if you are trying to run this code by simply pasting it into an HTML document its not going to work like it does in access. Hope I'm not overstepping my assumption by saying this, but it kind of sounds like thats what your saying in your post.
Mar 3 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
3085
by: Don Vaillancourt | last post by:
What's going on with Javascript. At the beginning there was the "undefined" value which represented an object which really didn't exist then came the null keyword. But yesterday I stumbled across "null" string. I know that I will get an "undefined" when I try to retrieve something from the DOM which doesn't exist. I have used null myself to initialize or reset variables. But in which
1
3482
by: Chris | last post by:
How do I stop displaying "undefined" when using the code below. The problem occurs as I want to display 5 items per page using setInterval but this causes 'mycars' to reach a value that doesn't exist eg. First time through loop would display Ford Vauxhall
3
6098
by: Ronald W. Roberts | last post by:
I'm not sure where this routine came from, but here is the problem. On certian computers this error occurs, but it does not on others. The error is: "Undefined Function "DIR" in expression". The form open event calls the CheckandRepairLinks without a varable being passed it it. CheckandRepairLinks
25
3096
by: Nitin Bhardwaj | last post by:
Well, i'm a relatively new into C( strictly speaking : well i'm a student and have been doing & studying C programming for the last 4 years).....and also a regular reader of "comp.lang.c" I don't have a copy of ANSI C89 standard,therefore i had to post this question: What is the difference between "unspecified" behaviour & "undefined" behaviour of some C Code ??
49
14520
by: matty | last post by:
Hi, I recently got very confused (well that's my life) about the "undefined" value. I looked in the FAQ and didn't see anything about it. On http://www.webreference.com/programming/javascript/gr/column9/ they say: <snip> The undefined property A relatively recent addition to JavaScript is the undefined property.
5
6504
by: Jason | last post by:
Hello, I am trying to dynamically create a table, then set its <td>'s onclick: var table = document.createElement("table"); var row = table.insertRow(-1); var td = row.insertCell(-1); td.onclick = myfunction; function myfunction(event) { alert(event);
26
2192
by: Frederick Gotham | last post by:
I have a general idea of the different kinds of behaviour described by the C Standard, such as: (1) Well-defined behaviour: int a = 2, b = 3; int c = a + b; (Jist: The code will work perfectly.)
5
10806
by: Nathan Sokalski | last post by:
I have an ASP.NET application which is giving the following JavaScript error: 'theForm' is undefined However, when I do a View Source one of the <scriptelements is as follows: <script type="text/javascript"> <!-- var theForm = document.forms;
6
6490
by: blackdogharry | last post by:
Hi, I am a novice VBA user. My access version is 2007 on Windows XP PC. I need to create a query that will take pre-existing text values of the B_status field (such as "Received_Emailed", "Processed" etc.) and return the numeric value depending on the value of the B_status value. So I would get 2 in the new field if the value of B_status is "Received_Emailed" and so on. I opened Visual Basic Editor and created a function under...
0
9487
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10069
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9735
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8736
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6556
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.