ACC: How to Add "(all)" to a Combo Box or List Box Control (128881)
The information in this article applies to:
- Microsoft Access 2.0
- Microsoft Access for Windows 95 7.0
- Microsoft Access 97
This article was previously published under Q128881 Advanced: Requires expert coding, interoperability, and multiuser skills.
SUMMARY
This article shows you how to create a sample user-defined Visual Basic
function called AddAllToList(). You can use this function to add "(all)" as
the first row of any existing combo box or list box control in a Microsoft Access application.
The Developer Solutions sample application (Solutions.mdb) that comes with
Microsoft Access demonstrates a similar technique for adding "(all)" to a
list, but the AddAllToList() function has the following advantages:
- It works with any existing combo box or list box control.
- You can specify in which column "(all)" is displayed.
- You can specify what you want the optional text to be. For example, you can change "(all)" to read "none" or "nothing."
- You do not need to change the code to change the optional text.
This article assumes that you are familiar with Visual Basic for
Applications and with creating Microsoft Access applications using the
programming tools provided with Microsoft Access. For more information
about Visual Basic for Applications, please refer to your version of the
"Building Applications with Microsoft Access" manual.
NOTE: Visual Basic for Applications is called Access Basic in Microsoft
Access version 2.0. For more information about Access Basic, please refer
to the "Building Applications" manual.
REFERENCES
You can find information,instructions, and examples in the Developer
Solutions sample application (Solutions.mdb) included with Microsoft
Access. For more information about adding "(all)" to a combo box or list box, open the Solutions.mdb database usually located in the ACCESS\SAMPLES
folder. Select "Get more mileage from combo boxes, list boxes, subforms,
and subreports" in the Select A Category Of Examples box, then "Add '(all)'
to a list" in the Select An Example box.
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kbhowto kbProgramming kbusage KB128881 |
---|
|