jwcolby
jwcolby at colbyconsulting.com
Wed Feb 11 11:08:27 CST 2009
Option Compare Database Option Explicit Private WithEvents mctlCbo As ComboBox Private Const cstrEvProc As String = "[Event Procedure]" Private mlngBackColor As Long Private Const clngBackColor As Long = vbCyan Private Sub Class_Initialize() Set mctlCbo = Nothing End Sub Function mInit(lctlCbo As ComboBox) Set mctlCbo = lctlCbo mctlCbo.BeforeUpdate = cstrEvProc mctlCbo.AfterUpdate = cstrEvProc mctlCbo.OnGotFocus = cstrEvProc mctlCbo.OnLostFocus = cstrEvProc End Function Private Sub mctlCbo_AfterUpdate() Debug.Print "AfterUpdate: " & mctlCbo.Name End Sub Private Sub mctlCbo_BeforeUpdate(Cancel As Integer) Debug.Print "BeforeUpdate: " & mctlCbo.Name End Sub Private Sub mctlCbo_GotFocus() Debug.Print "GotFocus: " & mctlCbo.Name mlngBackColor = mctlCbo.BackColor mctlCbo.BackColor = clngBackColor End Sub Private Sub mctlCbo_LostFocus() Debug.Print "LostFocus: " & mctlCbo.Name mctlCbo.BackColor = mlngBackColor End Sub -- John W. Colby www.ColbyConsulting.com