Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

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
Avatar of mbizup
mbizup
Flag of Kazakhstan image

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.
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No points, just piling on.  

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