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

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?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
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.


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.