Public Enum CtlType
ListBox ComboBox End Enum '_________________________________________________________ Public Sub SelectInList(lngID As Long, _ ctlList As Control, Optional ctl As CtlType, _ Optional blnRefresh As Boolean = True) Dim x If blnRefresh = True Then ctlList.Refresh End If For x = 0 To ctlList.ListCount - 1 If ctlList.ItemData(x) = lngID Then If ctl = ListBox Then ctlList.Selected(x) = True Else ctlList = ctlList.List(x) End If Exit Sub End If Next End Sub |