Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista General Discussion > Access 2000: Undefined function 'replace' in expression.

Reply
Thread Tools Display Modes

Access 2000: Undefined function 'replace' in expression.

 
 
Remou
Guest
Posts: n/a

 
      03-13-2008
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?
 
Reply With Quote
 
 
 
 
Jim
Guest
Posts: n/a

 
      03-14-2008

"Remou" <> schreef in bericht
news:4344ED78-4092-4144-91E3-...
>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


 
Reply With Quote
 
Remou
Guest
Posts: n/a

 
      03-14-2008
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,Print Date 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:

>
> "Remou" <> schreef in bericht
> news:4344ED78-4092-4144-91E3-...
> >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
>
>
>

 
Reply With Quote
 
Jim
Guest
Posts: n/a

 
      03-14-2008

"Remou" <> schreef in bericht
news:86E2AF38-9F79-4EBB-ABC6-...
> 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,Print Date 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:
>
>>
>> "Remou" <> schreef in bericht
>> news:4344ED78-4092-4144-91E3-...
>> >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,Print Date FROM tmpAnalysis
WHERE

ie a double quote after strSQL =

JimF




 
Reply With Quote
 
Remou
Guest
Posts: n/a

 
      04-16-2008
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:

>
> "Remou" <> schreef in bericht
> news:86E2AF38-9F79-4EBB-ABC6-...
> > 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,Print Date 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:
> >
> >>
> >> "Remou" <> schreef in bericht
> >> news:4344ED78-4092-4144-91E3-...
> >> >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,Print Date FROM tmpAnalysis
> WHERE
>
> ie a double quote after strSQL =
>
> JimF
>
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can't access my website in expression web Sandy Windows Vista General Discussion 1 01-08-2008 08:20 PM
Converting Access 2000 to Access 2007 - Not Eugene Rippen Windows Vista General Discussion 2 12-04-2007 12:46 AM
Access Vista Install DVD Files-Replace Corrupt Files uvbogden Windows Vista General Discussion 0 08-22-2007 10:02 AM
MS Word 2000 Send To function John Windows Vista Mail 1 08-10-2007 07:24 PM
Access 2000 and Vista HauxtonPhil Windows Vista Networking 0 08-07-2007 04:36 PM



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 47 48 49 50 51 52 53 54 55 56 57 58 59