How to Fix Microsoft Access OpenReport Type Mismatch with Multiple Conditions
Question details
The user needs to pass multiple text-based filter conditions as one correctly concatenated string in Microsoft Access DoCmd.OpenReport to avoid a type mismatch error.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Filtering an Access report with multiple text conditions using DoCmd.OpenReport where the WhereCondition is built from form values.
- Observed behavior
- DoCmd.OpenReport throws a type mismatch error when multiple text conditions are combined incorrectly.
Open the Access database and the form module that calls DoCmd.OpenReport, and confirm the report name and the field or control names used in the filter, such as Agent and Status.
Pass the complete WhereCondition as one VBA string
Use this when a type mismatch or unexpected filter occurs with multiple text conditions in Access OpenReport.
The WhereCondition argument is a single string. When multiple text conditions are combined, the full expression—including the word And and the surrounding quotes for text values—must be built as one VBA expression rather than passed as separate arguments.
In Access, open the form frmAgent in Design View, select the control that previews or prints the report, and open its event procedure in the Visual Basic Editor.
Replace the existing OpenReport statement with a single WhereCondition string: DoCmd.OpenReport "rptAgentStudentList", acViewPreview, , "[Agent].[Agent] = '" & Me.Agent & "' And [Status] = '" & Forms!frmAgent.cboFilterStatus & "'"
Save the module, open the form, choose a status such as Active, and run the report to confirm both text conditions are applied without a type mismatch.

Use WPS Office as a Free Microsoft Office Alternative for Daily Document Tasks
Access OpenReport type mismatch is a Microsoft Access VBA issue and must be corrected inside Access because WPS Office does not run Access VBA. For daily Word, Excel, and PowerPoint work, WPS Office is a free, lightweight Office-compatible suite with a familiar ribbon UI and seamless file migration.
- 1. Download and install WPS Office: Go to the official WPS Office download page, download the free installer, run it, and complete the installation.
- 2. Open your exported report data: In WPS Spreadsheets, open the .xlsx or .csv file exported from your Access query or report data source.
- 3. Filter and share the data: Use the Data tab and AutoFilter to apply multiple text conditions, or create a document with WPS Writer for report summaries.

Frequently Asked Questions
Why does DoCmd.OpenReport fail with type mismatch when I use two filter conditions?
The WhereCondition argument must be one complete string. If conditions or quotes are passed separately, VBA sees extra arguments and raises a type mismatch.
How do I include a combo box value such as cboFilterStatus in an OpenReport filter?
Concatenate the control value into the string and quote text values with single quotes: DoCmd.OpenReport "rpt", acViewPreview, , "[Status] = '" & Forms!frmAgent.cboFilterStatus & "'".
Should text values be single-quoted or double-quoted in Access WhereCondition?
Use single quotes around text values inside the where string, with double quotes around the whole VBA string expression. If a text value may contain an apostrophe, escape it by replacing ' with '' so it does not break the filter.
Can I use WPS Office to run Microsoft Access reports or VBA macros?
No. WPS Office does not run Access VBA or open Access report objects. Use Microsoft Access to fix OpenReport VBA, or export the report data to Excel/CSV and work with it in WPS Spreadsheets.
What is the easiest way to avoid Access filter string errors?
Store the complete filter in a string variable, use Debug.Print to inspect it before calling OpenReport, and wrap text values with single quotes to ensure the string is valid.




