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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use custom functions in SELECT query (ms access) ??

Status
Not open for further replies.

JohnyHooker

Programmer
Dec 11, 2001
3
CZ
I'm using MS Access database and I need to use my own functions in SELECT query, like this:

SELECT SomeTable.Name AS Name, MyFunction(SomeTable.Value) AS Result FROM SomeTable;

In access, I created some module and into that module I wrote the function like this: (in VB)

Sub MyFunction(value As Integer) As Integer
MyFunction = value+1 'for example
End Sub

(simply - the function computes some value form the given arguments - e.g. "sin(x)" function )

When I tried this query in MS Access, it worked perfectly, but when I passed the SAME query on the SAME database form "outdoor" (I mean -not from access, from VC++ program, .asp page and so on) I receive error message: undifined function 'MyFunction' (it seems as if the module wasn't found by the JET engine).

Can anybody help what I'm doing wrong ?? I need fuctions to compute some values in queries but I don't know how to do that.

Thanks for any help

Honza Kotera
 

User defined functions as well as some standard VBA functions are not available when referenced outside of Access. You cannot reference them from C++, ASP, etc.

Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top