ACC: How to Move to the Next Item in a Combo Box with DblClickID: Q184034
|
Advanced: Requires expert coding, interoperability, and multiuser skills.
This article shows you how to create a sample user-defined procedure that
enables you to cycle through the records in a combo box by using a
double-click.
Microsoft provides programming examples for illustration only, without warranty
either expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes that you
are familiar with the programming language being demonstrated and the tools used to
create and debug procedures. Microsoft support professionals 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 needs. If you have limited
programming experience, you may want to contact a Microsoft Certified Solution Provider
or the Microsoft fee-based consulting line at (800) 936-5200. For more information about
Microsoft Certified Solution Providers, please see the following page on the World Wide Web:
http://www.microsoft.com/mcsp/For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.aspThe following example demonstrates how to use the OnDblClick property and the ListIndex property of a combo box to cycle through the records in that combo box by double-clicking it.
Private Sub EmployeeID_DblClick(Cancel As Integer)
On Error GoTo Error_Handler
Me![EmployeeID].ListIndex = Me![EmployeeID].ListIndex + 1
Exit Sub
Error_Handler:
If Err.Number = 7777 Then
' End of the list - Move to the start.
Me![EmployeeID].ListIndex = 0
Exit Sub
Else
MsgBox Err.Description, vbOKOnly, "Error #" & _
Err.Number & " occurred"
End If
End Sub
For more information about the ListIndex property, search the Help Index for "ListIndex," or ask the Microsoft Access 97 Office Assistant.
Additional query words: drop-down
Keywords : kbdta kbdtacode AccCon PgmEvnt PgmHowto
Version : WINDOWS:7.0,97
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: July 6, 1999