tech on the net
Home About Us Feedback Site Map

Microsoft

Access Excel Word

Database

SQL Oracle / PLSQL SQL Server MySQL MariaDB PostgreSQL

Web Development

HTML CSS Color Picker

Language

C Language

More

ASCII Table Linux UNIX Java Clipart Joke of the Moment
Share this page:

MS Access: Trim function will not work in a report in Access 2003/XP/2000/97

Question: In Microsoft Access 2003/XP/2000/97, I've created a report and I'm trying to use the trim function in a field on the report. But when I try to, the field shows up as #Error.

How can I get the trim function to work in a report?

Answer: To use the trim function in Access, there are 2 steps that you must perform.

Let's look at a report to demonstrate.

In the picture below, we've tried to use the trim function on the Category Name field and it is generating a #Error for each line.

Microsoft Access

To fix this, open your report in design view and select the properties for the Category Name field (ie: the field that you are trying to apply the trim function to)

Step 1 is to set the Control Source property to:

=Trim([CategoryName])

Microsoft Access

Step 2 is to change the name of the text box (from the original name). If you leave the name as the original, Access will generate an error.

In our example, we've changed the Name property to:

CategoryNameTrim

Now when we run the report, the Category Name shows up properly. See below.

Microsoft Access