
ADO: VBA function in select statement
The OLE DB Provider for JET and all the MS Access ODBC drivers do not
support the use of MS Access's user-defined function in SQL queries. What
this means is that if you run an SQL query from within Access you can call
any
VBA function defined with global scope in a module in the .MDB file. If
you run the same query through ODBC or OLE-DB (including ADO/RDS) then the
VBA function will cause a User-defined function error.
If this is a must have feature then you can consider Automatiing an instance
of MS Access to run your query for you. Definitely for low
concurrency/performance situations only. A light-weight, full function SQL
Server such as Sybase Adaptive Server Anywhere (used to be SQL Anywhere)
might be the way forward here if MS SQL Server/Oracle/Sybase Adaptive Server
Enterprise are considered overkill.
\\|//
(o o)
~~~~oOOo~(_)~oOOo~~~~
Regards,
Tonix
MCP+Internet, MCSD
Quote:
>Perhaps I should provide some additional information:
>The program is a VC++ 6.0 front end using ADO 2.1
>rsRep->SetAnActiveConnection
>rsRep->CursorLocation = adUseServer;
>rsRep->Open(_bstr_t("select vba_func(aField) from Table"),
>vNull,adOpenStatic,adLockReadOnly,adCmdText);
> *** Exception ***
>[Microsoft][ODBC Driver] undefined function vba_func in expression
>Christian Bartling