Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem calling function in Query

Status
Not open for further replies.

asimasm

Programmer
Nov 27, 2000
62
AU
Hi
I have written a function in a module for access that returns a string value. Now when i call the function from a query written in ACCESS query editor then it works and executes perfectly. But when i pass the same SQLStatement from my VB project it gives me that the function is not defined.

I have query like this

Select EventID, GetStudentList(EventID) from Event;

here GetStudentList() function is written in VBA module. And this query runs fine in Access. But when i try to execute this query from my VB project then it gives me undefined Function
i.e VB Code

MyConnection.Execute "Select EventID,GetStudentList(EventID)
from Event"
It gives error
Can any body tell me how i can do this.
Thanks in advance
 
Since the query runs why not just call it with code:

DoCmd.OpenQuery "NameOfMyQueryAsString"

 
asimasm,
ADO doesn't know about the Access function, and can't, since Access isn't a server database. You can call queries and functions like this from Access if you create an Object as Access.Application, and run queries via that object, which will run Access as an ole server.
--Jim
 
Sorry I misunderstood your design. Where does your function GetStudentList reside? In the Access database or in your vB project?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top