Fix Invalid Use of Property Error When Filtering Access Form by Combo Box
Question details
The user encounters an 'Invalid use of property' error when attempting to filter a continuous form using RecordsetClone and a combo box value in Microsoft Access.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Filtering a continuous form by an EntityID selected from a combo box via VBA.
- Observed behavior
- Assigning an SQL string directly to RecordsetClone triggers an 'Invalid use of property' error instead of applying the desired data filter.
Ensure you have the exact spelling for your combo box (e.g., Combo51) and the target field name (e.g., EntityID) before modifying your VBA code.
Use the Form's Filter Property
Instead of assigning SQL to RecordsetClone, use the built-in Filter and FilterOn properties to safely filter form records.
RecordsetClone is designed to create a copy of the form's underlying records, but it cannot be directly assigned an SQL string. To filter the form's view dynamically based on a combo box selection, you should apply the condition directly to the form's Filter property.
Open your Microsoft Access form in Design View, select the combo box, and navigate to the Event tab in the Property Sheet to open the After Update VBA event.
In the VBA editor, type the code `Me.Filter = "EntityID = " & Me.Combo51` to set the filter condition based on the combo box selection.
Add the command `Me.FilterOn = True` immediately below to activate the filter.
To provide users with a way to remove the filter later, you can link a clear button to the command `Me.FilterOn = False`.

Try WPS Office for Your Everyday Productivity Needs
While WPS Office does not include a direct database replacement for Microsoft Access, it provides a comprehensive, lightweight, and free alternative to Word, Excel, and PowerPoint. You can easily manage large datasets, apply data filters, and sort information effortlessly with WPS Spreadsheet without needing complex VBA code.
- 1. Download WPS Office: Visit the official WPS website and click 'Free Download' to get the latest version.
- 2. Install the Software: Run the downloaded installer and follow the simple on-screen instructions to complete the setup.
- 3. Manage Data with WPS Spreadsheet: Open WPS Spreadsheet to import, filter, and sort your data using intuitive built-in tools.

Frequently Asked Questions
Why do I get 'Invalid use of property' when using RecordsetClone?
The RecordsetClone property in Access creates a copy of the form's underlying recordset. It is read-only in terms of direct assignment; you cannot assign an SQL string to it. You must use its built-in methods like FindFirst instead.
How do I navigate to a record instead of filtering it?
To move to a specific record without hiding the others, use `Me.RecordsetClone.FindFirst "EntityID = " & Me.Combo51`, and then set `Me.Bookmark = Me.RecordsetClone.Bookmark`.
Can I filter based on a text string instead of a number?
Yes, but if the combo box value is text, you need to wrap the value in single quotes within your VBA code: `Me.Filter = "FieldName = '" & Me.ComboName & "'"`.




