![ms word combo box function ms word combo box function](https://cdn.allthings.how/wp-content/uploads/2021/09/allthings.how-how-to-change-microsoft-word-to-light-mode-image-15.png)
' Useful if strSQL is longer than 32767 characters ' Works with any length of recordset results (up to 10000 in ADP) Here's a simple function which uses this idea to set a recordset to the combobox: ' Fills a combobox with the result of a recordset. I needed this because my SQL string was longer than 32 KB (lot of index values for WHERE ID IN(x,x,x,x,x.)). Using the recordset method works very well. The callback method has the big disadvantage that it is very slow and it is called once for every entry which makes it unuseable for a longer list. Patrick, the method you shown on your page has a big disadvantage (I tried that too on my own): The value list can only be 32 KB, if you exceed this limit the function will throw an error. Good method with using the Recordset property, thanks for that hint! I have already tried to use combobox's callback function, or to populate a list with the "addItem" method of the combobox. This recordset property is indeed available for the specific combobox object, not for the standard control object, and I was very surprised to discover it a few days ago. Unfortunately, when I display the form, I keep getting an empty combobox, with no records in it! Any help is highly appreciated. In debug mode, I am able to check that the recordset is properly created, with requested columns and data, and properly associated to the combobox control.
![ms word combo box function ms word combo box function](https://docs.microsoft.com/en-us/windows/win32/uxguide/images/ctrl-drop-image8.png)
connexionActive: is my permanent ADO connection to my database server.
![ms word combo box function ms word combo box function](https://i.joecomp.com/img/lists/821/4-quick-and-innovative-ms-word-productivity-tips_3.jpg)
RsPersonne.Open "SELECT id_Personne, nomPersonne FROM Tbl_Personne"įc().Controls("id_Personne").Recordset = rsPersonne Set rsPersonne.ActiveConnection = connexionActive
MS WORD COMBO BOX FUNCTION CODE
Inspired by the 2 previous examples, I wrote some code as follow: Dim rsPersonne as ADODB.recordset This is time consuming, specially with large tables.īeing able to use a recordset to populate a combobox control would allow the user to directly display data from the server's side. When I need to display server's side data in a combobox, I create a temporary local table and import requested records. These controls are usually populated with a "SELECT *" string in the 'rowsource' properties of the control, referencing a table or query available on the client's side of the app. 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.