ADO Data Control Error:Undefined function "Function Name" in Expression

Posted on 2006-03-29
Medium Priority
Last Modified: 2008-01-09
I have an MS Access database and I added a module. In the module I wrote a code that will round up time to the nearest hour. The function works in my queries in MS Access but when I set the recordsource of ADO Data Control in Visual Basic, I get an error message: Undefined function 'RoundUpTime' in expression. What seems to be the problem? And How would I fix it?
Question by:blue_bird
  • 2
LVL 15

Expert Comment

ID: 16319093
Undefined function 'RoundUpTime' in expression indicates that the code is unable to find the function named 'RoundUpTime' in the form or module you are using it in. I'm not sure how you are defining your function, but you could try to change this
Private Function RoundUpTime
Public Function RoundUpTime

This will allow the module to be seen throughout the program
LVL 11

Accepted Solution

leclairm earned 1500 total points
ID: 16321825
It's because the RoundUpTime function exists in your access mdb and you are trying to use it through ado which isn't possible as far as I know.  Return the field in your query as it is in the mdb and create a function in visual basic that will round it up when required.

Expert Comment

ID: 16322406
Hi Blue_Bird,

Leclairm is right. ADO Cannot execute the VB code within the database, because that code isn't part of the Jet drivers. You can only call default functions supported by Access, like Left, Right, Mid, IsNull, InStr, Sum, Min, Max, Count, etc. I agree with leclairm that you should return the normal time value, and round it afterwards in your VB code.

Please don't accept this comment as an answer... Leclairm came first. I'm just posting because you might want a second opinion on this.

Expert Comment

ID: 16583514
Hi Dan,

I believe Leclairm gave the right solution. I believed he was right, so I created a test case just to be sure. The test turned out that Leclair IS right. He also gave a possible workaround, to which Blue_Bird hasn't responded. This answers both Blue_Bird's questions.



Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question