We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

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

blue_bird
blue_bird asked
on
Medium Priority
490 Views
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?
Comment
Watch Question

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
to
Public Function RoundUpTime

This will allow the module to be seen throughout the program
.Net Developer  ERP integration
Commented:
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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Commented:
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.

Commented:
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.


Cheers,

Luc
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.