William Benson (VBACreations.Com)
vbacreations at gmail.com
Thu Aug 11 13:54:01 CDT 2011
Just in case the name of the listbox seems confusing it is because I later
on changed the control to a listbox, but I had code referring to it in a
number of places and just have not had time to rename it.
I click on an item in a listbox and I can tell I have selected it but
whenever I test for Selected = true, Access is not reporting the true state
of the selected property.
There are column heads.
Any idea why?
Function ActiveReportID() As Long
Dim i As Long
Dim Frm As Form
On Error Resume Next
Set Frm = Forms("FrmMatchReport")
If Frm Is Nothing Then
ActiveReportID = 0
Exit Function
End If
With Frm
For i = 1 To .Controls("cboReportHeader").ListCount - 1
If .Controls("cboReportHeader").Selected(i) Then 'Seems always to be
false even when staring at the control I can tell it's true!
ActiveReportID = .Controls("cboReportHeader").Column(0, i)
Exit Function
End If
Next
End With
End Function