Problem : Undefined function ‘Replace’ in expression
I’m baffled with this one. I using MS Access to query a database which works fine but when I use a secondary program that connects to the Access Database via ODBC I get the following error:
ERROR  [Microsoft][ODBC Microsoft Access Driver] Undefined function ‘ReplaceText’ in expression.
Unfortunately I cannot have the secondary program bypass Access. It has to use it. I’m trying to replace newlines with empty strings in a text field.
Solution : Undefined function ‘Replace’ in expression
Very limited time at the moment – shouldn’t even be posting, but just a quick effort and then off.
When you’re connecting from outside of Access you’re working exclusively with Jet.
Jet has the ability to extend beyond it’s own set of shared VBA functions using the expression service in Access.
This then includes your own user defined functions (as well as Access UI objects – i.e. form controls).
Once outside of Access then you’re accessing Jet directly and are limited to the subset of functions that *are* explicitly shared. (One of Jet’s component dlls is vbajet32.dll which affords that function exposure and offers the expression service).
After SP1 of Access 2000 – Replace was referenced properly (whereas previously it had been incorrectly shared as MX alluded to). However AFAICR it remains a non-native Jet function.
You’re executing this request from a source such as VB? And what (as Jim asked) is the exact SQL text of the request you’re making?
You can either perform the Replace on the text after you’ve retrieved it (i.e. *not* in the query but in the code of your calling app on the retrieved data) or instantiate an instance of Access and use DAO methods of the Access object to allow the expression service to call the function and run your query.
CurrentDb is the saviour that makes it possible – but you then have the non-negligible overhead of instantiating an Access instance, and that requires that Access is even installed!
The fact that you’re using .NET to retrieve the results should render that an impossible solution (i.e. a DAO recordset). FWIW even just ADO’s CurrentProject does not offer the same “get out of jail free card” that DAO’s CurrentDb does.