[AccessD] Listbox item Selected property staying false after clicking an item

William Benson vbacreations at gmail.com
Thu Aug 11 16:44:28 CDT 2011


It is 0. Sometimes when it is zero I have had better luck with selected.

Isn't the selected property changed before enterimg the afterupdate event ?
On Aug 11, 2011 5:29 PM, "Charlotte Foust" <charlotte.foust at gmail.com>
wrote:
> Have you tried using the list index to return the selected items?
>
> Charlotte Foust
>
> On Thu, Aug 11, 2011 at 10:12 AM, William Benson (VBACreations.Com) <
> vbacreations at gmail.com> wrote:
>
>> I click on n 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
>>
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>>
>>
>> Website: http://www.databaseadvisors.com
>>
>>
>>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com



More information about the AccessD mailing list