Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Undefined function REPLACE in expression

39 views
Skip to first unread message

Cornelia

unread,
Apr 24, 2003, 11:59:12 AM4/24/03
to
When I try to run an update query (MS Access 2000) in a
query on Last Name field - REPLACE ([LastName], "ñ", "n")-
I receive the followinf error : 'Undefined
function 'REPLACE'in expression.' I would appreciate any
working solutions.

John Spencer (MVP)

unread,
Apr 24, 2003, 12:56:28 PM4/24/03
to
Quote from Dirk Goldgar, MS Access MVP

The Replace function works in Access 2000 VBA, but it can't be used directly
in queries. You need to create a user-defined "wrapper" function that
receives arguments of the appropriate types, passes them on to the Replace
function, and returns the Replace function's result. Here's one:

'---- start of code ----
Function fncReplace(strExpression As String, _
strFind As String, _
strReplace As String, _
Optional lngStart As Long = 1, _
Optional lngCount As Long = -1, _
Optional lngCompare As Long = vbBinaryCompare) _
As String

fncReplace = Replace(strExpression, strFind, strReplace, _
lngStart, lngCount, lngCompare)

End Function
'---- end of code ----

I don't know offhand whether this problem has been fixed in Access 2002.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

Cornelia

unread,
Apr 24, 2003, 1:54:55 PM4/24/03
to
Dirk, thank you very much. I'll try it and get back to
you. Unfortunately my VBA is very limitted. All I needed
is to replace ñ in Last Name field with regular n. Again,
thank you.

>.
>

Ken Snell

unread,
Apr 24, 2003, 2:57:56 PM4/24/03
to
Yes, it works in ACCESS 2002.
--
Ken Snell
<MS ACCESS MVP>

"John Spencer (MVP)" <spence...@SPAMNOT.umbc.edu> wrote in message
news:3EA8173C...@SPAMNOT.umbc.edu...

0 new messages