Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TRIM Function in a Report

Status
Not open for further replies.

Chinyere

Programmer
Mar 9, 2001
79
US
Hello All :-D,

I am seeking assistance with the TRIM function in a report. I have a text string that I would line to trim. I therefore use:

=Trim([name])

in the expession builder.

However, when I try to preview the report, a dialog box pops up with the word "Trim" on top and a blank text box below it (I guess it wants me to input how much to Trim).

My hope is to bypass this dialog box and to trim my text string. When I try to bypass it, the word "#Error" is displayed in place if my text string ("name") on the report.

Does anyone out there know of a workaround that I can use to have the Trim function work correctly and display my text strings properly?

I have a label that I would like to place flush against the text strings and as they all vary in length I would really like to have this Trim function working proerly.

I would truly appreciate any assistance from anyone out there!

Chinyere
 
Hi Chinyere,

=Trim([Name]) Has to be the Control Source property for your textbox, and the Record Source for the report has to be a query or table that includes the field "Name". If you are set up like this, the problem lies elsewhere...Write back with your findings please! Gord
ghubbell@total.net
 
Hi Gord,

Thank you for your prompt response. Yes, I actually do have =Trim([Name])as the Control Source and the Record Source for the report does contain the field "Name".

Do you or anyone else out there then know what could be causing all that I have described above? Thank you.

Chinyere
 
I got it! silly me...."Name" is kind of a key word so you might have to do this. Go to the query and change its name (don't get confused here!) like this: XName: Name (in the query grid) Now in your report... =Trim([XName]) !
Gord
ghubbell@total.net
 
Gord,

Thanks again for your response. I am afraid that I don't understand exactly what you mean. It seems to make sense to me reading it but doing it is the problem. I am thinking that if I rename the field that the report will not know how to call it up. Please help with detailed instructions, if you don't mind :).

Chinyere
 
OK!
With the report in design view, double-click on the black square in the top left corner of the view. This will bring up the reports properties dialog. Find the Data tab, and find the property named "Record Source". click once on this and you will see a small button on the right "..." . Click on it. You should now be looking at the query that is the "source" for your report.

Find in the "QBE" grid a column that probably says [Name] (and has the name of your table just below it). Highlight [Name] (deleting it) and type in:
XName:[Name]

You can try and run this query right now if you want to test it and if we did everything correctly, your "Name" column now is named "XName". If we're good to here, close the query, yes to changes... and back to the report:

Your text field currently says =Trim([Name]) and lets change it to =Trim([XName]).

If all goes well we're done! close and save and Pleeease! tell me if its a go or not! You can do it!



Gord
ghubbell@total.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top