Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Newsgroups > Vista General

Vista - Access 2000: Undefined function 'replace' in expression.

Reply
 
Old 03-13-2008   #1 (permalink)
Remou


 
 

Access 2000: Undefined function 'replace' in expression.

I am using Access 2000 sp1 with Sp2 and Sp3 installed and the Vista version
of Jet on a Vista laptop. The above error is returned when using the replace
function in a query, although it is available in VBA. Does anyone know if
there is a fix for this?

My System SpecsSystem Spec
Old 03-14-2008   #2 (permalink)
Jim


 
 

Re: Access 2000: Undefined function 'replace' in expression.


"Remou" <Remou@xxxxxx> schreef in bericht
news:4344ED78-4092-4144-91E3-27D8EFDADD20@xxxxxx
Quote:

>I am using Access 2000 sp1 with Sp2 and Sp3 installed and the Vista version
> of Jet on a Vista laptop. The above error is returned when using the
> replace
> function in a query, although it is available in VBA. Does anyone know if
> there is a fix for this?
If you also posted the query, it might help.

JimF


My System SpecsSystem Spec
Old 03-14-2008   #3 (permalink)
Remou


 
 

Re: Access 2000: Undefined function 'replace' in expression.

Thank you for your reply.

I was referring to any query, rather than a specific query, and I was hoping
for a hotfix, rather than a code fix. I am using a UDF at the moment to deal
with the problem, but it is tedious, because the computer on which the
database is to be used allows Replace in a query.

Here is an example of using Replace, and it does not work:

'========================================
strSQL = "SELECT Format(Nz(Member,False),'Yes/No') As
Mem,Title,Forename,Surname,InvoiceNumber,InvoiceTo," _
& "Replace(InvoiceToAddress,(Chr(13)+Chr(10)),'<BR>') As
Address,Amount,InvoiceDate,PaidDate,AuthDate,PrintDate FROM tmpAnalysis WHERE
" _
& Me.Filter
'========================================

However, if I change Replace to refer to this UDF all is well:

'========================================
Function FindAndReplace(ByVal strInString As String, _
strFindString As String, _
strReplaceString As String) As String


FindAndReplace = Trim(Replace(strInString & " ", strFindString, _
strReplaceString))

End Function
'========================================

As you can appreciate, Replace is a very useful function in queries, and I
would prefer not to have to add a UDF to every new DB.

"Jim" wrote:
Quote:

>
> "Remou" <Remou@xxxxxx> schreef in bericht
> news:4344ED78-4092-4144-91E3-27D8EFDADD20@xxxxxx
Quote:

> >I am using Access 2000 sp1 with Sp2 and Sp3 installed and the Vista version
> > of Jet on a Vista laptop. The above error is returned when using the
> > replace
> > function in a query, although it is available in VBA. Does anyone know if
> > there is a fix for this?
>
> If you also posted the query, it might help.
>
> JimF
>
>
>
My System SpecsSystem Spec
Old 03-14-2008   #4 (permalink)
Jim


 
 

Re: Access 2000: Undefined function 'replace' in expression.


"Remou" <Remou@xxxxxx> schreef in bericht
news:86E2AF38-9F79-4EBB-ABC6-629FAD5AA6E0@xxxxxx
Quote:

> Thank you for your reply.
>
> I was referring to any query, rather than a specific query, and I was
> hoping
> for a hotfix, rather than a code fix. I am using a UDF at the moment to
> deal
> with the problem, but it is tedious, because the computer on which the
> database is to be used allows Replace in a query.
>
> Here is an example of using Replace, and it does not work:
>
> '========================================
> strSQL = "SELECT Format(Nz(Member,False),'Yes/No') As
> Mem,Title,Forename,Surname,InvoiceNumber,InvoiceTo," _
> & "Replace(InvoiceToAddress,(Chr(13)+Chr(10)),'<BR>') As
> Address,Amount,InvoiceDate,PaidDate,AuthDate,PrintDate FROM tmpAnalysis
> WHERE
> " _
> & Me.Filter
> '========================================
>
> However, if I change Replace to refer to this UDF all is well:
>
> '========================================
> Function FindAndReplace(ByVal strInString As String, _
> strFindString As String, _
> strReplaceString As String) As String
>
>
> FindAndReplace = Trim(Replace(strInString & " ", strFindString, _
> strReplaceString))
>
> End Function
> '========================================
>
> As you can appreciate, Replace is a very useful function in queries, and I
> would prefer not to have to add a UDF to every new DB.
>
> "Jim" wrote:
>
Quote:

>>
>> "Remou" <Remou@xxxxxx> schreef in bericht
>> news:4344ED78-4092-4144-91E3-27D8EFDADD20@xxxxxx
Quote:

>> >I am using Access 2000 sp1 with Sp2 and Sp3 installed and the Vista
>> >version
>> > of Jet on a Vista laptop. The above error is returned when using the
>> > replace
>> > function in a query, although it is available in VBA. Does anyone know
>> > if
>> > there is a fix for this?
>>
>> If you also posted the query, it might help.
>>
>> JimF
>>
>>
>>
It is a long time since I did any programming in Access and maybe I am just
being stupid but perhaps the following might help:

strSQL = ""SELECT Format(Nz(Member,False),'Yes/No') As
Mem,Title,Forename,Surname,InvoiceNumber,InvoiceTo," _
& "Replace(InvoiceToAddress,(Chr(13)+Chr(10)),'<BR>') As
Address,Amount,InvoiceDate,PaidDate,AuthDate,PrintDate FROM tmpAnalysis
WHERE

ie a double quote after strSQL =

JimF




My System SpecsSystem Spec
Old 04-16-2008   #5 (permalink)
Remou


 
 

Re: Access 2000: Undefined function 'replace' in expression.

Replace does not work regardless of the query with which it is used. Replace
does not work when used in the Query design screen. Sadly, replace does not
even work with VBScript and ADO. The same error is returned in each case,
that is, Undefined Function.

The SQL of the query is proving to be a red herring, I fear.

"Jim" wrote:
Quote:

>
> "Remou" <Remou@xxxxxx> schreef in bericht
> news:86E2AF38-9F79-4EBB-ABC6-629FAD5AA6E0@xxxxxx
Quote:

> > Thank you for your reply.
> >
> > I was referring to any query, rather than a specific query, and I was
> > hoping
> > for a hotfix, rather than a code fix. I am using a UDF at the moment to
> > deal
> > with the problem, but it is tedious, because the computer on which the
> > database is to be used allows Replace in a query.
> >
> > Here is an example of using Replace, and it does not work:
> >
> > '========================================
> > strSQL = "SELECT Format(Nz(Member,False),'Yes/No') As
> > Mem,Title,Forename,Surname,InvoiceNumber,InvoiceTo," _
> > & "Replace(InvoiceToAddress,(Chr(13)+Chr(10)),'<BR>') As
> > Address,Amount,InvoiceDate,PaidDate,AuthDate,PrintDate FROM tmpAnalysis
> > WHERE
> > " _
> > & Me.Filter
> > '========================================
> >
> > However, if I change Replace to refer to this UDF all is well:
> >
> > '========================================
> > Function FindAndReplace(ByVal strInString As String, _
> > strFindString As String, _
> > strReplaceString As String) As String
> >
> >
> > FindAndReplace = Trim(Replace(strInString & " ", strFindString, _
> > strReplaceString))
> >
> > End Function
> > '========================================
> >
> > As you can appreciate, Replace is a very useful function in queries, and I
> > would prefer not to have to add a UDF to every new DB.
> >
> > "Jim" wrote:
> >
Quote:

> >>
> >> "Remou" <Remou@xxxxxx> schreef in bericht
> >> news:4344ED78-4092-4144-91E3-27D8EFDADD20@xxxxxx
> >> >I am using Access 2000 sp1 with Sp2 and Sp3 installed and the Vista
> >> >version
> >> > of Jet on a Vista laptop. The above error is returned when using the
> >> > replace
> >> > function in a query, although it is available in VBA. Does anyone know
> >> > if
> >> > there is a fix for this?
> >>
> >> If you also posted the query, it might help.
> >>
> >> JimF
> >>
> >>
> >>
>
> It is a long time since I did any programming in Access and maybe I am just
> being stupid but perhaps the following might help:
>
> strSQL = ""SELECT Format(Nz(Member,False),'Yes/No') As
> Mem,Title,Forename,Surname,InvoiceNumber,InvoiceTo," _
> & "Replace(InvoiceToAddress,(Chr(13)+Chr(10)),'<BR>') As
> Address,Amount,InvoiceDate,PaidDate,AuthDate,PrintDate FROM tmpAnalysis
> WHERE
>
> ie a double quote after strSQL =
>
> JimF
>
>
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
regex replace function VB Script
Replace special characters with regular expression VB Script
Replace function on a variable? VB Script
can't access my website in expression web Vista General
MS Word 2000 Send To function Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46