• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 348
  • Last Modified:

Trying to replace text value on a report

This is a crazy issue I'm sure but I am trying to replace the value in a text field on a report with another text string if certain criteria exists.  Here is my code but it doesn't work.

    If Me.txtStreet.Value = "original text" Then
        Me.txtStreet.Value = "new text"
    End If

I've tried onprint and onformat both.

--Steve
0
SteveL13
Asked:
SteveL13
  • 3
1 Solution
 
mbizupCommented:
Your code looks okay.

What section of the report is txtStreet in?

Use the Format or the Print event of that specific section.

In other words if it is in the header, use the Header Format or print events.  If it is in the Detail section, use Detail Format or Print.

Also some events don't execute in Report View in Access 2007/2010.   If you have been using Report View, try Print Preview instead.
0
 
mbizupCommented:
Also to make sure that you are not including extraneous spaces, try this:


    If Trim( "" & Me.txtStreet.Value) = "original text" Then
        Me.txtStreet.Value = "new text"
    End If

Open in new window

0
 
Dale FyeCommented:
No points, just piling on.  

My guess is that it is the Preview vs Report View issue as mbizup mentions above.
0
 
mbizupCommented:
If that is indeed the case, it will be the third time I've seen it in the past 24 hours. :)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now