Others

Fix Access Runtime Error 3061 When Filtering an Unbound Form

Huda QurayshiHuda Qurayshi Nov 20, 2026 869 views

Question details

The user needs to filter results for an unbound Access form using an ID selected in a list box.

Fix Access Runtime Error 3061 When Filtering an Unbound Form
Product
Microsoft Access
Device & OS
not provided
Scenario
A list-box selection opens another form and supplies an ID for a query.
Observed behavior
The VBA code raises runtime error 3061, reporting that one parameter is missing.
Before you start

Check the list box's Bound Column property and confirm that its selected value is the ID used by the query. Identify the actual table, ID field, and data type before editing the SQL.

Solution 1Recommended

Insert the selected numeric ID into the SQL statement

Use this approach when the form remains unbound and VBA retrieves its data using a numeric ID.

Access may treat a variable name written inside an SQL string as an unresolved parameter rather than the VBA value. Build the SQL using the selected value outside the quoted string. Replace Schedules and SchID in the example with your actual table and field names.

1
Open the event code

Open the form in Design View, select the control that opens the results form, and use its Property Sheet > Event tab to open the relevant event procedure in the VBA editor.

2
Validate the selection

Before building the query, check Me.lstWO.Value for Null and verify that it is numeric. If no valid ID is selected, display a message and exit the procedure.

3
Build and run the SQL

For an integer numeric ID, build the query with: sql = "SELECT * FROM Schedules WHERE SchID = " & CLng(Me.lstWO.Value). Then use Set rs = CurrentDb.OpenRecordset(sql), with sql declared as String and rs as DAO.Recordset. Use the returned fields to populate the unbound form's controls.

4
Inspect the query

Add Debug.Print sql before opening the recordset. In the VBA editor, open View > Immediate Window and check the printed SQL for the selected ID and correct table and field names.

Insert the selected numeric ID into the SQL statement
Text IDs need different handling: The example is for integer numeric IDs. For text IDs, use a parameterized QueryDef rather than inserting unescaped text into SQL.
Free Microsoft Office alternative

Work with Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with compatible Office documents. It can help you move everyday document, spreadsheet, and presentation work to one suite, but it does not fix Access VBA errors or replace an Access database.

A familiar interface for everyday Office workCompatible with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXFree, lightweight tools for opening and editing Office filesKeep spreadsheet reports alongside your Access database workflow
microsoft office alternative - wps office

Frequently Asked Questions

What does Access error 3061 mean?

It means Access expected one or more query parameters but did not receive their values. A misspelled field name or a VBA variable name left inside an SQL string can cause this error.

How can I see the SQL Access is trying to run?

Place Debug.Print sql before the OpenRecordset call, then open View > Immediate Window in the VBA editor to inspect the completed SQL.

Why does the list box return the wrong value?

In the form's Design View, select the list box and check Property Sheet > Data > Bound Column. Its value determines which column is returned by Me.lstWO.Value.

Will DoCmd.OpenForm filter an unbound form's VBA query?

Not automatically. The WhereCondition applies to the opened form's record source; an unbound form that retrieves data in VBA must use the ID in its own query.

What should I do if the selected ID is text?

Use a parameterized QueryDef and assign the selected list-box value to its parameter before opening the recordset. Do not use CLng on a text ID.