PDA

View Full Version : Solved: UDF problem with ADO query



Danny
12-27-2009, 11:03 PM
I am using ADO to get a recordset from an access query into excel. Then populate a userform with the data in that recordset. I have been doing this without a problem until I created a query in access that uses a user defined function in one of the fields. The UDF is stored in module 1 of the access database. This query works fine when it is executed within access, but when I try to pull it into a recordset from excel it gives the error : Runtime-error '-2147217900 (80040e14)' Undefined function 'WrkDay' in expression. I would appreciate any ideas for a solution.
Thanks,
Danny

Jan Karel Pieterse
12-27-2009, 11:36 PM
You cannot use UDF's in queries using ADO. You must either do the calculation afterwards, using the data returned by the recordset, or find an SQL compatible workaround that uses no UDF to do the calc.

stanl
12-28-2009, 08:07 AM
Possibly as a workaround you could create a stored procedure in the Access db (cannot use UI for this, must be coded) which would include a call to the UDF. However, IMHO, even if it works it will execute slowly. .02 Stan