How to Populate an Excel VBA ComboBox from an ADODB Recordset
Question details
The user needs to populate a VBA ComboBox with data fetched from an ADODB Recordset, but lacks a direct binding property.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Developing Excel VBA macros or userforms that require pulling dynamic data from an external database using ADODB.
- Observed behavior
- Excel VBA ComboBox controls do not natively support direct ADODB Recordset binding because they lack a Recordset property.
Ensure you have enabled the 'Microsoft ActiveX Data Objects Library' reference in your VBA Editor (Tools > References) so that your ADODB objects function properly.
Use the ComboBox Column Property (Direct Method)
This is the most efficient and straightforward method. It uses the GetRows method to assign data directly to the Column property without needing to transpose it.
The ADODB Recordset's GetRows method naturally returns data in a two-dimensional array structured as (Columns, Rows). Because the ComboBox's Column property expects data in exactly this orientation, you can assign the array directly.
Press Alt + F11 to open the VBA Editor, and navigate to the code module for your UserForm.
Ensure your connection string is active and open the recordset containing the desired database query.
Use the GetRows method on your recordset to push the target field into the ComboBox. Write the code: Combo.Column = RstComboPopulating.GetRows(Fields:=FieldName).
Close the recordset to free up system memory by adding: RstComboPopulating.Close followed by Set RstComboPopulating = Nothing.

Use the ComboBox List Property with Transpose
Use this method if you specifically need to populate the List property or if you need to manipulate the array data prior to assigning it to the ComboBox.
Looking for a Lightweight and Compatible Office Suite?
If you frequently manage complex spreadsheets, analyze large datasets, or handle legacy macro files, WPS Office offers a fast, familiar, and highly compatible alternative. It's designed to streamline your workflow without the heavy system requirements.
- 1. Visit the WPS Website: Go to the official WPS Office website to find the free installer.
- 2. Download and Install: Run the lightweight installer package and follow the on-screen instructions.
- 3. Open Your Spreadsheets: Launch WPS Spreadsheets and open your existing documents to start working immediately.

Frequently Asked Questions
Why can't I bind the ADODB recordset directly to the VBA ComboBox?
Unlike data controls in MS Access or VB6, standard Excel VBA ComboBoxes lack a 'DataSource' or 'Recordset' property for native data binding. You must manually extract the data, typically using the GetRows method, and assign it to the control.
What happens if my ADODB Recordset is empty when calling GetRows?
If the recordset is empty, calling GetRows will throw a run-time error (such as Error 3021: Either BOF or EOF is True). You should always verify that 'RstComboPopulating.EOF' is False before attempting to fetch rows.
Can I limit the number of records populated in the ComboBox?
Yes. The GetRows method accepts an optional 'Rows' parameter. For example, using 'GetRows(50)' will return only the first 50 records from your active ADODB query.
Do I need to loop through the recordset to add items?
While you can loop through records using 'ComboBox.AddItem', fetching the data en masse via 'GetRows' and applying it to the Column or List property is much faster and reduces code complexity.




