Microsoft KB Archive/90139

= ACC: &quot;#Error&quot; Message Using TRIM Function in Form or Report =

Article ID: 90139

Article Last Modified on 1/18/2007

-

APPLIES TO


 * Microsoft Access 1.0 Standard Edition
 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q90139



Moderate: Requires basic macro, coding, and interoperability skills.



SYMPTOMS
If you have a form or report that has its RecordSource property defined as a table that contains no records, &quot;#Error&quot; is displayed when you preview the report or view the form in Form view if a bound control is defined by using the Trim function.



CAUSE
When you use an expression to define the ControlSource property for a form or report, Microsoft Access evaluates the expression and presents the result for the control. If a blank field is evaluated, &quot;#Error&quot; appears.



STATUS
This behavior is by design.



Steps to Reproduce Behavior

 * 1) Create a table with two text fields named Field1 and Field2.
 * 2) Create a report based on this table.
 * 3) Add the Field1 and Field2 fields to the detail section of the report.
 * 4) Modify the ControlSource property for the Field1 field as follows:

=Trim([Field1])
 * 1) Preview the report. Note that the Field1 field contains #Error and that the Field2 field is blank.
 * 2) Create a form based on the table.
 * 3) Add the Field1 and Field2 fields to the form.
 * 4) Repeat step 4.
 * 5) View the form in Form view. Note that the Field1 field contains #Error and that the Field2 field is blank.

