Using ADO to execute a query in an Access 2000 or 2002 database that calls a Public function 
Author Message
 Using ADO to execute a query in an Access 2000 or 2002 database that calls a Public function

HiHiHi,

I have an Access 2002 Database (also several Access 2000 dbs) that has
several Public finctions in a modue. Several of the access queries
call the functions. When I execute the queries in Access, everything
works. When I call the queries via ADO, the queries break.

An example of an error is:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Undefined function
'BuildKeyPath' in expression.

BuildKeyPath is a public function in a module called 'RegSpt'

Here is part of the query:
SELECT blah,blah,blah ..., BuildKeyPath([regID)] As SubKeyPath, blah
blah blah ...;

I have tried several methods of calling the query via ADO as well as
variations of Recordset.Open and variations of CommandObject.Execute.
I have also tried all of the CommandTypes that are available.

The questions I have are:
1- Can I call a public function through ADO? If so, how?
2- Is it possible to execute/open a query through ADO that executes
public functions? If so, how?

I checked various websites and the MSDN site(s) to no avail.

TIA

-{*filter*}-
*****
I never >try< anything
I just do it.

Wanna Try Me?
*****



Sun, 15 May 2005 14:17:43 GMT  
 Using ADO to execute a query in an Access 2000 or 2002 database that calls a Public function
Hi,
Within the Access environment, you can run queries that
reference functions. Once you step outside of that
environment, ADO knows nothing of your functions, it just
sends the SQL to Jet, bypassing what I believe is called the
'expression service'. So, in a nutshell, you can't use queries that
refer to functions.

HTH
Dan Artuso, MVP


Quote:
> HiHiHi,

> I have an Access 2002 Database (also several Access 2000 dbs) that has
> several Public finctions in a modue. Several of the access queries
> call the functions. When I execute the queries in Access, everything
> works. When I call the queries via ADO, the queries break.

> An example of an error is:
> Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
> [Microsoft][ODBC Microsoft Access Driver] Undefined function
> 'BuildKeyPath' in expression.

> BuildKeyPath is a public function in a module called 'RegSpt'

> Here is part of the query:
> SELECT blah,blah,blah ..., BuildKeyPath([regID)] As SubKeyPath, blah
> blah blah ...;

> I have tried several methods of calling the query via ADO as well as
> variations of Recordset.Open and variations of CommandObject.Execute.
> I have also tried all of the CommandTypes that are available.

> The questions I have are:
> 1- Can I call a public function through ADO? If so, how?
> 2- Is it possible to execute/open a query through ADO that executes
> public functions? If so, how?

> I checked various websites and the MSDN site(s) to no avail.

> TIA

> -{*filter*}-
> *****
> I never >try< anything
> I just do it.

> Wanna Try Me?
> *****



Sun, 15 May 2005 20:18:31 GMT  
 Using ADO to execute a query in an Access 2000 or 2002 database that calls a Public function

27 Nov 2002 07:18:31 -0500, managed to coherently babble:

Hola,

Thanx for answering.

ATTN: MICROSOFT. IF SOMEONE WORKING FOR MICROSOFT IS READING THIS, THE
COMPANY NEEDS TO FIX THIS IN EITHER JET 5, THE NEXT ADO UPDATE OR
WHATEVER TECHNOLOGY COULD SOLVE THIS PROBLEM.

This is surprising me and frustrating me. Something like this is why I
stopped using Access several years ago. It wasn't until Access 2000
with it's 'Access Database Projects' that I started looking at Access
as a useful tool again.

ok, enough whining.

The query already exists exists in the database (as if it were a
stored procedure). The external ADO function isn't referencing the
function directly, only the 'precompiled' query living in the database
is.

It defies logic  that a query stored in the database cannot access a
custom function stored in the same database when the query is called
from an external application using ADO.

The functions in the access database perform calculations on the data.
This architecture was chosen to prevent each different application
(some ASP apps, some custom apps) from having to perform the same
calculations on the data. Also to insure that the calculations could
be updated in one location.

So. I see my options as the following:
1- Use DAO (bleh). I don't like this because it's possible that 100 or
more users could use an application which accesses the database
simultaneously. DAO would require a separate instance of the database
to be created for each user.

2- Move the calculations to the applications. This means more work for
me. :(

3- Move the database to MSSQL server (or some other DBMS) and create
extended stored proceudres to manipulate the data.

Any other ideas?

Thanx for your patience.

-{*filter*}-

3- Move the database to MSSQL or the MSDE and create extended stored
procedures.

?Hi,
?Within the Access environment, you can run queries that
?reference functions. Once you step outside of that
?environment, ADO knows nothing of your functions, it just
?sends the SQL to Jet, bypassing what I believe is called the
?'expression service'. So, in a nutshell, you can't use queries that
?refer to functions.

*****
I never >try< anything
I just do it.

Wanna Try Me?
*****



Sun, 15 May 2005 23:36:25 GMT  
 Using ADO to execute a query in an Access 2000 or 2002 database that calls a Public function


Quote:

> ATTN: MICROSOFT. IF SOMEONE WORKING FOR MICROSOFT IS READING THIS, THE
> COMPANY NEEDS TO FIX THIS IN EITHER JET 5, THE NEXT ADO UPDATE OR
> WHATEVER TECHNOLOGY COULD SOLVE THIS PROBLEM.

Cobblers. ADO is about data, not about GUIs and user functions. ADO code
can be called in a variety of environments, including VB, Excel or
Powerpoint, VBS, Perl, ASP etc. etc. Its job is simply to send and fetch
data from tables.

It has long been an anomalous, if welcome, facility for DAO users in Access
that we have been able to call Access code from SQL -- but this is the
exception, not the rule. There is no "fix" here, any more than Excel's
table functions are missing in Word and need to be fixed.

Quote:
> 1- Use DAO (bleh). I don't like this because it's possible that 100 or
> more users could use an application which accesses the database
> simultaneously. DAO would require a separate instance of the database
> to be created for each user.

So what? Oh I see, I thought you meant 100 times Dim db As Database...
Microsoft says you can open a mdb with 255 concurrent users, but it starts
to get hairy after a dozen or so. See (3) below. Using a split architecture
helps, but I don't know if I'd use Jet for that many people.

Quote:
> 2- Move the calculations to the applications. This means more work for
> me. :(

And reduced performance. You may be able to carry out the functions within
SQL anyway using the builtin functions: check the help.

Quote:
> 3- Move the database to MSSQL server (or some other DBMS) and create
> extended stored proceudres to manipulate the data.

And you were worried about the extra work in (2)??! Probably the best idea
though, for future proofing and because you are pushing Jet with 100
concurrent users. I hope you are doing frequent backups!

Tim F



Mon, 16 May 2005 03:46:14 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Excel 2002 hanging when using ADO (vba) + SQL Server 2000

2. Calling a query from an Access database using ADO

3. Access 2002 unable to create table in 2000 database

4. ADO - Error querying linked database tables in ACCESS 2000

5. Access 97 upgrade to Access 2000 or Access 2002

6. Access 2000 VBA code not working Access 2002

7. Application written for Access 2000 with DAO won't run in Access 2002

8. ACCESS 2000 TO ACCESS 2002

9. Att: MS Rita Nikas per your request: Access 2000/2002 Error Accessing File

10. Access 2000 vs. Access 2002 (XP)

11. Need help to Update an ACCESS 2000 Database using ADO and VB

12. Searchable database on the web using Access 2002?

 

 
Powered by phpBB® Forum Software