How to populate a ComboBox with a Recordset using VBA

前端 未结 6 761
星月不相逢
星月不相逢 2021-02-15 13:34

There is some literature available at expert\'s exchange and at teck republic about using the combobox.recordset property to populate a combobox in an Access form.

The

6条回答
  •  盖世英雄少女心
    2021-02-15 14:03

    As was said, you have to get the RowSourceType to "Table/List" (or "Table/Requête" if in french) in order to show query results in the combobox.

    Your memory problems arise from opening the recordset (rsPersonne) without closing it. You should close them when closing/unloading the form (but then again you would have scope problems since the recordset is declared in the function and not in the form).

    You could also try to create and save a query with Access's built-in query creator and plug that same query in the RowSource of your combobox. That way the query is validated and compiled within Access.

提交回复
热议问题