Resting Anchor

The Anchorage

Personal website of Gregory K. Maxey, Commander USN (Retired)

Populate UserForm ListBox or ComboBox
w\Advanced Functions
(A Microsoft Word Help & Tip page by Gregory K. Maxey)

DISCLAIMER/TERMS OF USE

The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.

Click to acces PayPal Verification Service Click to acces PayPal Verification Service

However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.

If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!

Click to donate British Pound Sterling                   Click to donate US dollars                   Click to donate EU euros

The purpose of this Microsoft Word Tips & Microsoft Word Help page is to expand and amplify my popular Populate Userform ListBox or ComboBox tips page. While much of the information in that page is still helpful and relevant, this page is intended to offer improved methods and advanced functions in a consolidated single UserForm demonstration.

Here I will offer streamlined techniques for populating lists as well as functions for managing (sorting and positioning items contained in the list).  While I am an "Old Dog," I've been learning some new tricks using SQL statements and the methods demonstrated here for populating list from Excel and Access rely solely on those statements.

To view and participate in the demonstration, you will need to download the following demonstration package:  Demo Pack

After downloading the package, unzip and store all the contained files in a common folder.  For illustrative purposes, I have stored all the package content files in a folder "C:\Demo" 

List of files

After storing the files, open Word and open the file "Advanced List and CB Fill and Functions"

Site Note iconNote: The demonstration document is a Word macro-enabled document.  If you did not save the files in a trusted location, when the document opens you may be prompted to enable content.  If you don't enable content or if there is no prompt to enable content then the macros will be disabled and the demonstration will not work.  Modify your trusted locations or security settings to ensure the content is enabled.

The document opens as shown below:

Document view

Double-click in the first "DC Here" MacroButton field to display the single column userform advanced functions.

Userform display

Double-click in the second "DC Here" MacroButton field to display the multi-column userform fill and advanced functions.  The presented UserForm contains six multi-column/multi-select ListBoxes.  View each ListBox by selecting the multi-page control page tabs. Each ListBox is populated using different techniques and data sources.

Use the command buttons adjacent to the ListBoxes to demonstrate the advanced functions.  The "OUTPUT" button generates a formatted output message string. 

Mult-column fill and advanced funcitons

Clicking the SQL Query Examples tab presents a slightly different view.  With this view you can populate the ListBox using one of four example SQL statements.

After clicking one of the examples, the definition of the data displayed in the ListBox and SQL statement used is provided.

ListBox 6 SQL Examples

ListBox 6 SQL Example 3

Working on these demonstration UserForms, I realized that my demonstration document in Populate Userform ListBox or ComboBox had grown unwieldy.  Wanting to fix that without losing the individual UserForms displayed in the tips page, I consolidated that material in the following demonstration package:  Demo Pack

As with the previous demo pack, unzip all of the packaged files into a common folder.  Open Word and open the file "Populate UserForm LB or CB (Consolidated)"

The document opens as shown below:

Document displayed

Simply double-click any of the various Macrobutton fields, to display the demonstration userform.

Simple coded lists

Simple Coded Lists

Fill from Word

Filled from Word

Filled from Access

Filled from Access
(various methods employed)

Filled from Excel

Filled from Excel
(various methods employed)

Linked Lists

Linked Lists
...
and so on

Site Note Icon Notes:
      1. While the code contained in these demonstrations represent a collection of considerable knowledge, it is not all knowledge learned or obtained through my own efforts.  I still consider myself a compete novice when it comes to Excel and Access and the area of SQL statements is one I've just discovered.  There is a lot to learn there.

      2. The truth is that much of the knowledge is knowledge shared with me or developed in collaboration with others.  MVP Doug Robbins has spoon fed Access and Excel interoperability for as long as I remember;  much of the ListBox functions is adapted from material published by Excel guru Chip Pearson; and of course MVP Graham Mayor who has struggled over a lot of it with me over the years.  There are others too numerous to mention.  Thank you all!!

That's it! I hope you have found this tips page useful and informative.

Share

DISCLAIMER/TERMS OF USE

The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.

Click to acces PayPal Verification Service Click to acces PayPal Verification Service

However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.

If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!

Click to donate British Pound Sterling                   Click to donate US dollars                   Click to donate EU euros

Search my site or the web using Google Search Engine

Google Search Logo