ACC2000: Can't use Replace() in Control Source of report

A

A Man

Hi, I have a report in Access 2000. In a Control source of a text box I
have: =Trim(replace(UCase([LIST5]),"PER BOX","")).

Access does not recognize the replace function. Am I missing a reference
here? How do I fix this? LIST5 is my actual field and I want to remove
the string "PER BOX" from LIST5 if it exists.

Thanks.
 
K

Ken Snell \(MVP\)

Are you fully patched and updated for your 2000 ACCESS program? ACCESS 2000
did not recognize Replace function in queries and expressions until SP3, I
believe.
 
G

Guest

A work around would be to create a function to do the replace and make the
function the control source:

Private Function FormatControl(varOriginal As Variant) As String
FormatControl = Trim(replace(UCase(Nz([LIST5], vbNullString)), _
"PER BOX", vbNullString))
End Function

Note using Variant in the function is in case there is a null value in the
field LIST5]
Also, change of "" to vbNullString. Using an intrinsic constant rather than
a literal is a performance enhancer.

Since the Replace is in a function it should work.
--
Dave Hargis, Microsoft Access MVP


Ken Snell (MVP) said:
Are you fully patched and updated for your 2000 ACCESS program? ACCESS 2000
did not recognize Replace function in queries and expressions until SP3, I
believe.

--

Ken Snell
<MS ACCESS MVP>


A Man said:
Hi, I have a report in Access 2000. In a Control source of a text box I
have: =Trim(replace(UCase([LIST5]),"PER BOX","")).

Access does not recognize the replace function. Am I missing a reference
here? How do I fix this? LIST5 is my actual field and I want to remove
the string "PER BOX" from LIST5 if it exists.

Thanks.
 

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