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

Is it possible to execute VBAcode from external app via ADO like ASP?

Status
Not open for further replies.

hercule2

Programmer
Nov 30, 2003
12
FR
hercule2 (Programmer) Nov 30, 2003
Hi, I'm french,

Using Access 2000 I have written a small VBA routine inside of standard module. I have also written a query that calls this routine to modify one of the columns in a table, ie. to strip punctuation characters from the column, eg.

select name, MyFunc([name])
from myTable
where name = "myname"

MyFunc (in fact function replace) is defined in Module1 as a function that currently returns its argument (will put in the stripping details later!), eg.


Public Function MyFunc(ByVal s As String) As String
MyFunc = s
End Function

After i do a compil.

This all works fine if I run the query within the Access environment.

However, if I try to execute the query from ADO (within a web page ASP or a VB app), I get an error saying:


[Microsoft][ODBC Microsoft Access Driver]undefined function 'MyFunc' in expression

If I modify my query to use a built in function, such as Lcase$(), it works fine (because the query structure is fine).

I have also tried this without going through ODBC (using OLEDB from Visual Basic) without success.

So, is it actually possible to call a user-defined function from outside of the Access environment, and if so, how????

Any suggestions (solutions with ASP and access for exemple) are appreciated !



 
You can't call an access module externally as if it were a stored procedure in SQL server. You can probably re-code the procedure in ASP with little re-work because VBA and ASP are similiar. Mike

Mike Pastore

Hats off to (Roy) Harper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top