Microsoft KB Archive/287454

= ACC2002: At Sign in RecordSource Property Causes Error Message =

Article ID: 287454

Article Last Modified on 11/5/2003

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q287454



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

This article applies only to a Microsoft Access project (.adp).



SYMPTOMS
When you create a form or a report where the RecordSource property is set to a SELECT statement containing the at sign (@) in the WHERE condition, you receive an error message similar to this one:

Closing delimiter not found for the string beginning at position 56 in the command. The string begins with: '? }) AS RS_37.

NOTE: The position number and the number at the end of the error message may vary.



CAUSE
Microsoft Access incorrectly evaluates the at sign in a string literal to be a parameter sign and subsequently executes the SELECT statement as a parameter query.



RESOLUTION
Replace the SELECT statement in the RecordSource property of your form or report with a view based on the same SQL statement.

To change the RecordSource property from a SELECT statement to a view, follow these steps:
 * 1) Open your form or report in Design view.
 * 2) Press CTRL+R to select the form or report. On the View menu, click Properties.
 * 3) Click the Data tab of the Properties dialog box.
 * 4) Select the entire contents of the RecordSource property and press CTRL+C to copy the selection to the Clipboard.
 * 5) Close the form or report.
 * 6) Click Queries in the Database window, and then click New.
 * 7) Select Design View, then click OK.
 * 8) Click Close in the Add Table dialog box, and then click SQL on the toolbar.
 * 9) Delete any text automatically inserted in the SQL Text Editor. On the Edit menu, click Paste.

This step inserts the text you copied in step 4.
 * 1) Save and close the view.
 * 2) Repeat steps 1 to 3 to open the form or report's Properties dialog box.
 * 3) Replace the contents of the RecordSource property with the name of the view you created in step 10. Close the Properties dialog box, and then open the form or report in Datasheet view. The form or report should open without error, and any records matching your criteria are found.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
This issue only affects SELECT statements in the RecordSource property.

Steps to Reproduce the Behavior
CAUTION: If you follow the steps in this example, you modify the sample Access project NorthwindCS.adp. You may want to back up the NorthwindCS.adp file and follow these steps on a copy of the project.

 Start Microsoft Access and open the sample project NorthwindCS.adp. Open the Products form in Design view.  Change the RecordSource property to: SELECT * FROM Products WHERE ProductName='@test'  Open the form in Datasheet view.

A dialog box appears, prompting for &quot;test'&quot; as if it was a parameter. Enter &quot;Chai&quot; as the parameter value. You receive the error message described in the &quot;Symptoms&quot; section of this article.</li></ol>

<div class="references_section">