I wrote a function in a particular database, and the function works. It works both when I call it to set the value of an unbound control on a form, and when I call it in a query. So, to preserve this function, I created a new database, and imported the module. But in the new database, in a query I’m getting ““Undefined function…”” and on the form, “”#Name?“”. I went to debug mode of the module and the function isn’t even recognized. The references of both database appear to be the same. I consulted the Microsoft Knowledge base and was not able to find anything that appeared to be relevent. Does anyone have any ideas about this? Thank you. _________________ Joel Dwyer Simplicity is the ultimate sophistication. -Leonardo Da Vinci
Thanks for the quick reply and the advice. I think I will have to accomplish this simple function call, that Access can do in one step, using multiple steps in .NET. : ( Judie
From: Philip Marcus via access-l [mailto:access-l@groups.ittoolbox.com]
Sent: Tuesday, January 06, 2009 10:09 AM
To: Baker, Judie
Subject: RE:[access-l] Undefined Function In Expression
[http://userimages.toolbox.com/user/b_293712.jpg]
Judie,
Apparently .net cannot look inside an MDB file, find the code in a given form and execute it. I am
not all that surprised, but .net is not my bag. Maybe someone in a .net forum knows better.
Phil
From: “OldKoloa via access-l”
Judie,
Apparently .net cannot look inside an MDB file, find the code in a given form and execute it. I am
not all that surprised, but .net is not my bag. Maybe someone in a .net forum knows better.
Phil
From: “OldKoloa via access-l”
Phil, I am trying to do the same thing except I’m calling the function from within a vb.net windows form.
I am getting the same “Undefined Function in Expression” error. I have also copied the function into the project and it is being called from the select statement.
I have tried this two different ways.
-
CommandType.StoredProcedure by calling the Access query directly - that calls the Access public function inside an Access module.
-
CommandType.Text by using a select statement inside the project that calls the public Function inside the project.
Either way I am getting the Undefined Function in Expression error.
Just to note, this all works in Access but will not work in my vb dotNet windows app.
Any ideas will be greatly appreciated. thanks Judie
Phil, you are right, i has to rewrite those functions in VB and Once I will get my desired recordset i will send that recordset objects to Crystal,
Thanks for your response.
Regards,
Khalid.
What is wrong is that your function and the module containing it are only
visible from within the Access .mdb. The Crystal SQL engine certainly cannot
see the function, nor can VB.
You can copy and paste the function into a module in your VB project and I
think you will have success. As for Crystal, it will have to be copied in and
conformed to Crystal’s requirements for creating a function. This forum will
not be able to help you with Crystal after you copy and paste the function.
HTH
Phil
From: " khalidu… via access-l"
Dear Friends,
I have a MS Access 2002 Database with a module/Function name ReturnQty. Which returns a variable on certain input arrguments,
I used this Module/Function Inline in one of my MS-Access Query, and it works fine, But when I tried to use this query in
Crystal Reports 9 or In Visual Basic 6 (using ADo) the error message returns “Undefined Function ‘ReturnQty’ In Expression”,
can any one help me whats wrong, Kindly its urgent, and if you have any solution, please provide an example
The Actual Query is as follows which works find in MS-Access but Not In MS-VB6 or Crystal Reports 9 → Command Object.
SELECT Curr, ReturnQty(Curr,‘01-July-2004’,‘31-July-2004’,‘P’) AS PurQty, ReturnQty(Curr,‘01-July-2004’,‘31-July-2004’,‘S’) AS SalesQty FROM TranDetails GROUP BY Curr
Need Urgent Help.
Regards,
Khalid.
The new databse, the one that refers to the one with the fucntion in it,
must have a reference to the one with the function, as if it were soem
kind of miscrosft library, for example.
Phil
I fixed it. I created a new database and pull in the module again, and it =
worked. Perhaps the first database suffered corruption (working over a=20
network?)
Please respond to access-l@openitx.com
To: Joel F Dwyer