Function IsSelected(strField As String, _
strForm As String, _
strControl As String) As Boolean

'Author: Michael Blake
'Contact: www.weAscend.com
'If using this function please include above information
'PersonID = The field in the query that corresponds to
' the bound column value of the list box.
'frmMailing = The form the list box is on.
'lstNames = The name of the list box

Dim varStore As Variant
Dim ctlList As Control

On Error GoTo Error_Handler

Set ctlList = Forms(strForm).Controls(strControl)

If ctlList.ItemsSelected.Count = 0 Then GoTo None_Selected

For Each varStore In ctlList.ItemsSelected
IsSelected = (strField = ctlList.Column(0, varStore))
If IsSelected Then GoTo Exit_Function

Exit Function

IsSelected = False
GoTo Exit_Function

IsSelected = False
GoTo Exit_Function

End Function


Contact Us