this is an example so you experts don't spent your time understanding the function but spent your time finding the solution to this problem
Main Topics
Browse All TopicsHi Experts,
I got a complex scheduling program that was made with access then we made a vb.net interface that connect to the access. in that access program the queries often use vba code to run in the query itself to return a calculated value on a row by row basis.
I'm not able to execute these particular query in ado.net it throw an exception that says:
undefined function 'calcxyz' in expression.
is there a way to run those queries?
see the code
the code works perfectly if I remove any reference to calcxyz
Please help
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
"is there a way to run those queries?"
Yes, if you didn't like the answer, please explain why and we'll go from there.
Your CalcXYZ function isn't doing any sort of error checking, or manipulating the data in a way that SQL can't handle already, so it's pretty superfluous...so what is your reasoning for adding them outside of your query?
Ok
The function called calcxyz in the example does a lot of calculation i.e. opening a calendar table and verifing if its a valid date and returning a date taking into account a buffer and hrs needed to produce a product at a specific machine... obviously the queries are not really called qry1 and qry2 and the functions name is not calcxyz.
when i run the qry in access it returns the proper values...
the problem lies in ado.net it throw an exception when i call the query.
undefined function 'calcxyz' in expression
this example is an easy way to test the problem.
I have thousands lines of code in access doing exactly what should be done.
Right now in order to make these functionalities work I have to rewrite the code in .net which i find unproductive since I still need the database and the queries to run the program.
Ah, that is a completely different question. Please understand that some users here are very inexperienced and that very simple questions (like I thought yours was) do come along often.
I do not believe it is possible to call a VBA function in a MS Access database from VB.NET in that manner. What I would do is re-write the function in VB.NET and then perform your calculations there. It may require a few more calls to the database though. You could also upgrade the database to SQL Server and convert the function to a stored procedure (if you have that option).
If it helps, I did a little research just to back up my theory and found the following:
http://www.experts-exchang
it seems that there's a way to do stored procedure in access...
But this solution does not suit my problem but maybe others might find it useful
http://www.devcity.net/Art
Business Accounts
Answer for Membership
by: TorrwinPosted on 2009-11-05 at 10:53:10ID: 25752615
Looks like a pretty simple function, you could just replace it in your query:
Qry1:SELECT x,y,z, (x+y+z) as calcField from Tbl_fake;