BUG: "Syntax Error in PARAMETER clause" When Opening an MFC DAO Recordset

ID: Q233972


The information in this article applies to:


SYMPTOMS

When opening an MFC DAO Recordset on an Microsoft Access parameterized query in an MFC AppWizard project, the application displays a message box containing the following error:

Syntax error in PARAMETER clause
The error occurs when the parameter names for the query have a space in them; for example, "Param 1".


CAUSE

CDaoRecordset does not build the PARAMETERS clause correctly. For example, the following SQL statement may be constructed:


PARAMETERS Some Param Text;
SELECT * from [AccessQuery] 
The syntax error occurs because of the space between "Some" and "Param".


RESOLUTION

Following are two ways to work around the problem:


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a query in Microsoft Access that contains an input parameter.


  2. Create an MFC AppWizard project that accesses the query created in step 1.


  3. Run the Application.


Additional query words:


Keywords          : kbDAO350 kbDatabase kbMFC kbAppWizard kbGrpVCDB 
Version           : winnt:6.0
Platform          : winnt 
Issue type        : kbbug 

Last Reviewed: June 23, 1999