Undefined Function 'Replace' in Expression

E

Eric J Owens

A2k running on win2k adv serv (sp3)

In a calculated field I have:

NewName:
Replace([router].[name],Left([Router].[Name],InStr([Router].[Name],"_")-1),[
router].[sitecode])

but get an error (ref. subject of post). While checking to ensure the
expression was returning what I wanted, i worked from inside to outside of
expression to test and the other functions work fine. I tried the procedure
proposed by John Vinson's 7/9 reply post (check/uncheck references so access
will re-link), but this did not help. Also, KB310803 didn't seem to work
out either (re-registering a dll).

Any help would be greatly appreciated.
 
E

Eric J Owens

Thanks for the explanation! That answers other questions I was begining to
have as well! You MVP's can be real time savers, and are appreciated for
it!

Thanks again,

EricO.


Ken Snell said:
With your ACCESS version, Replace is not available in queries or control
sources or macro conditions. You can create your own function and use that
to call the Replace function. For example, use an expression similar to
this:

RReplace(([router].[name],Left([Router].[Name],InStr([Router].[Name],"_")-1)
,[router].[sitecode])

and put this function in a regular module:

Public Function RReplace(strStringValue As String, strCurrString As String,
strNewString As String)
RReplace = Replace(strStringValue, strCurrString, strNewString)
End Function

I believe you may be able to fix this A2K behavior if you update to SP6
version of Jet4.0. Among us MVPs, we've discovered that some A2K versions do
handle Replace correctly (A2K2 does it well), and we seem to have identified
the difference as the version of Jet.
--
Ken Snell
<MS ACCESS MVP>


Eric J Owens said:
A2k running on win2k adv serv (sp3)

In a calculated field I have:

NewName:
Replace([router].[name],Left([Router].[Name],InStr([Router].[Name],"_")-1),[
router].[sitecode])

but get an error (ref. subject of post). While checking to ensure the
expression was returning what I wanted, i worked from inside to outside of
expression to test and the other functions work fine. I tried the procedure
proposed by John Vinson's 7/9 reply post (check/uncheck references so access
will re-link), but this did not help. Also, KB310803 didn't seem to work
out either (re-registering a dll).

Any help would be greatly appreciated.
 
K

Ken Snell

You're welcome.

Eric J Owens said:
Thanks for the explanation! That answers other questions I was begining to
have as well! You MVP's can be real time savers, and are appreciated for
it!

Thanks again,

EricO.


Ken Snell said:
With your ACCESS version, Replace is not available in queries or control
sources or macro conditions. You can create your own function and use that
to call the Replace function. For example, use an expression similar to
this:
RReplace(([router].[name],Left([Router].[Name],InStr([Router].[Name],"_")-1)
,[router].[sitecode])

and put this function in a regular module:

Public Function RReplace(strStringValue As String, strCurrString As String,
strNewString As String)
RReplace = Replace(strStringValue, strCurrString, strNewString)
End Function

I believe you may be able to fix this A2K behavior if you update to SP6
version of Jet4.0. Among us MVPs, we've discovered that some A2K
versions
do
handle Replace correctly (A2K2 does it well), and we seem to have identified
the difference as the version of Jet.
Replace([router].[name],Left([Router].[Name],InStr([Router].[Name],"_")-1),[
router].[sitecode])

but get an error (ref. subject of post). While checking to ensure the
expression was returning what I wanted, i worked from inside to
outside
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top