ACC2002: At Sign in RecordSource Property Causes Error Message (287454)



The information in this article applies to:

  • Microsoft Access 2002

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.
  10. Save and close the view.
  11. Repeat steps 1 to 3 to open the form or report's Properties dialog box.
  12. 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.

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

    A dialog box appears, prompting for "test'" as if it was a parameter.
  5. Enter "Chai" as the parameter value. You receive the error message described in the "Symptoms" section of this article.

REFERENCES

For more information about the RecordSource property, click Microsoft Access Help on the Help menu, type RecordSource in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

Modification Type:MajorLast Reviewed:11/5/2003
Keywords:kbbug kberrmsg kbnofix KB287454