Article ID: 210290 - Last Review: June 23, 2005 - Revision: 3.1 How to add '(all)' to a combo box or a list box control in an Access 2000 applicationThis article was previously published under Q210290 For a Microsoft Access 97 version of this article,
see
128881
(http://support.microsoft.com/kb/128881/
)
. Advanced: Requires expert coding,
interoperability, and multiuser skills. This article applies only to a Microsoft Access database (.mdb). On This PageSUMMARY This article shows you how to create a sample user-defined
Microsoft Visual Basic function that is called AddAllToList(). This article also shows you how to create a Union Query. You can
use either the function or the Union query to add "(all)" as the first row of
any existing combo box or list box control in a Microsoft Access application.
The sample application, Solutions9.mdb, is available from the following Microsoft Web site:
Microsoft Access 2000: Building Applications with Forms and Reports The sample application demonstrates a similar technique for
adding "(all)" to a list. However, the AddAllToList() function has the following advantages:
http://msdn.microsoft.com/en-us/library/aa188219.aspx (http://msdn.microsoft.com/en-us/library/aa188219.aspx)
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. How to Create the AddAllToList() FunctionTo create and to use the sample user-defined Visual Basic function, AddAllToList(), follow these steps:
How to Use the Union Query MethodThe following example demonstrates how you can use the Union query on the Employees form in the sample database Northwind.mdb. The query adds "All" as the first row of the ReportsTo combo box drop-down list so that you can clear the selection if you select a manager for an Employee.CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.
How to Use the AddAllToList() FunctionThe following example demonstrates how you can use the AddAllToList() function on the Orders form in the sample database Northwind.mdb. The function adds "<No Salesperson>" as the first row of the Salesperson combo box drop-down list so that you can clear the selection if you select a salesperson for an order in which no salesperson was involved.CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.
REFERENCESFor more information about combo boxes, click Microsoft Access Help on the Help menu, type combo boxes: what they are and how they
work in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned. To find information, instructions, and examples in the sample application (Solutions9.mdb), visit the following Microsoft Web site:
Microsoft Access 2000: Building Applications with Forms and Reports
http://msdn.microsoft.com/en-us/library/aa188214(office.10).aspx
(http://msdn.microsoft.com/en-us/library/aa188214(office.10).aspx)
For more information about adding "(all)" to a combo box or list
box, follow these steps:
| Article Translations
|
Back to the top
