Search:     Advanced search

OpenRecordsetQuery Statement Using SQL Queries with Single Quotes Do Not Work

Article ID: 799  |  Last updated: 29 Dec, 2014


Using the OpenRecordsetQuery statement with a SQL query argument that contains single quotes does not work and a syntax error is returned.


SQL queries require single quotation marks with a Unicode value of 0096 (decimal). The single quote characters used in the QA Wizard Pro script editor are Unicode value 0039 (decimal).


Use the Chr function to convert single quotes in the SQL query to the correct Unicode character. The following example shows the correct syntax:

query = "SELECT * FROM [Sheet1$] WHERE " + Chr(0096) + "First Name" + Chr(0096) + "=""John"""

dataset = OpenRecordSetQuery("Wysicorp EXCEL Data", query)

Article ID: 799  |   Last updated: 29 Dec, 2014
OpenRecordsetQuery quotation mark single quote syntax error SQL query

Prev   Next
Web Controls Not Displayed in Preview Screenshots     Testing .NET Windows Forms Applications