Others

Fix Access DoCmd.OpenForm Data Type Mismatch Error 3464

John WilsonJohn Wilson Nov 25, 2026 868 views

Question details

The user needs to correct a DoCmd.OpenForm WhereCondition that causes a data type mismatch.

Fix Access DoCmd.OpenForm Data Type Mismatch Error 3464
Product
Microsoft Access
Device & OS
not provided
Scenario
A VBA procedure opens a form filtered to a record using an ID or another field.
Observed behavior
Access displays error 3464 when the filter criteria use a value that does not match the field's data type.
Before you start

In Access, open the form's underlying table in Design View and check the data type of the field used in the filter. Also check that the control supplying the value is not Null before building the criteria.

Solution 1Recommended

Match the OpenForm filter to the field's data type

Use the correct delimiters for numeric, text, or date criteria to avoid error 3464.

The WhereCondition is a SQL-style expression without the word WHERE. Access evaluates the field and value according to their data types, so quoting a numeric value as text can cause a mismatch.

1
Find the OpenForm statement

Open the relevant form in Design View, select the control that runs the code, and open its event procedure from the Property Sheet. Find the DoCmd.OpenForm statement in the VBA editor.

2
Correct a numeric ID filter

For a numeric ID, remove quotation marks around the value: DoCmd.OpenForm "tblReport", acNormal, , "[ID] = " & Me![ID]. Replace tblReport with the actual form name and ID with the appropriate field and control names.

3
Use delimiters for text or dates

For text, enclose the value in single quotes and escape any apostrophes: "[CustomerName] = '" & Replace(Me!txtCustomerName, "'", "''") & "'". For a date, use number signs and an unambiguous format: "[StartDate] = #" & Format$(Me!txtStartDate, "mm\/dd\/yyyy") & "#".

4
Run the procedure again

Save the VBA code, return to Form View, and trigger the control or event that opens the form. Check that the intended record appears without error 3464.

Check date and time values: A date equality filter may not match records whose field also contains a time. If times are stored, use a date range that includes the full day instead.
Free Microsoft Office alternative

Work with Office documents in WPS Office

WPS Office is a free, lightweight alternative for working with documents, spreadsheets, and presentations in a familiar interface. Open compatible Office files to make migration easier. It does not fix Access VBA errors or replace an Access database application.

Open and edit compatible Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXUse a familiar interface for everyday Office tasksWork with tabular data in WPS Spreadsheets alongside your database workflowGet a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does putting quotes around a numeric ID cause error 3464?

Quotes identify the value as text in the filter expression. If the ID field is numeric, build the WhereCondition without quotes around the value, such as "[ID] = " & Me![ID].

How do I filter OpenForm by a text value containing an apostrophe?

Enclose the text value in single quotes and use Replace to double any apostrophes: "[CustomerName] = '" & Replace(Me!txtCustomerName, "'", "''") & "'".

What delimiters does Access use for dates in a filter?

Enclose date values in number signs, for example: "[StartDate] = #" & Format$(Me!txtStartDate, "mm\/dd\/yyyy") & "#". Check whether the field also stores a time before using an equality filter.

Where can I check the data type of the filter field?

Open the form's underlying table in Access Design View and look at the Data Type column for the field used in the WhereCondition.