B
Brian
I have this SELECT query in an Access 2003 DB:
SELECT Customer.CustomerID, GetBalanceByCustomerID([BillToCustomerID]) AS
Balance
FROM Customer
WHERE (((Customer.BillToCustomerID)=[parmCustomerID]));
GetBalanceByCustomerID is this custom function:
Public Function GetBalanceByCustomerID(CustomerID As Variant) As Currency
If IsNull(CustomerID) Then
GetBalanceByCustomerID = Null
Else
GetBalanceByCustomerID = Nz(DLookup("[Balance]", "[LookupBalance]",
"[BillToCustomerID] = " & [CustomerID]), 0)
End If
End Function
The query runs fine within Access. However, I have a developer that wrote an
ADO.NET application that passes the query name & parameter via a connection
string and now calls the query using an ADO.NET application. The query works
(i.e. ADO.NET correctly receives the results) when I leave out the function,
but when I include the function, I get the following error:
Undefined function 'GetBalanceByCustomerID' in expression
Here is the connection string:
connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=D:\Data\Apps\HartCraft\DeliveryCraft\Web\DCraftWeb.mdb"
Why would ADO.NET even try to interpret the function? Shouldn't that be
internal to Access, with ADO.NET just receiving the results of the query as
called?
SELECT Customer.CustomerID, GetBalanceByCustomerID([BillToCustomerID]) AS
Balance
FROM Customer
WHERE (((Customer.BillToCustomerID)=[parmCustomerID]));
GetBalanceByCustomerID is this custom function:
Public Function GetBalanceByCustomerID(CustomerID As Variant) As Currency
If IsNull(CustomerID) Then
GetBalanceByCustomerID = Null
Else
GetBalanceByCustomerID = Nz(DLookup("[Balance]", "[LookupBalance]",
"[BillToCustomerID] = " & [CustomerID]), 0)
End If
End Function
The query runs fine within Access. However, I have a developer that wrote an
ADO.NET application that passes the query name & parameter via a connection
string and now calls the query using an ADO.NET application. The query works
(i.e. ADO.NET correctly receives the results) when I leave out the function,
but when I include the function, I get the following error:
Undefined function 'GetBalanceByCustomerID' in expression
Here is the connection string:
connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=D:\Data\Apps\HartCraft\DeliveryCraft\Web\DCraftWeb.mdb"
Why would ADO.NET even try to interpret the function? Shouldn't that be
internal to Access, with ADO.NET just receiving the results of the query as
called?