William Benson
vbacreations at gmail.com
Fri Aug 12 06:24:57 CDT 2011
I used to have it explicitly referred to the way you said. Ill try again and get back to you. It was a single select listbox. Nearly all my almost all my controls are drifting towards datasheet subforms nowadays. Much more predictable, sortable, and nice events. On Aug 12, 2011 1:07 AM, "Charlotte Foust" <charlotte.foust at gmail.com> wrote: > Just a twinge in my gray matter, but try testing explicityly for > > Controls("cboReportHeader").Selected(i) =True > > and see what you get. Oh, and is this a regular or multiselect listbox? > > Charlotte Foust > > On Thu, Aug 11, 2011 at 7:48 PM, William Benson (VBACreations.Com) < > vbacreations at gmail.com> wrote: > >> I took your advice... AfterUpdate is not a place I want to be checking >> .Selected property. Perhaps unless dealing with a multiselect listbox it is >> never efficient to use Selected property. But for whatever reason >> .ListIndex >> and I have not gotten along well in the past (he says it's me). >> >> -----Original Message----- >> From: accessd-bounces at databaseadvisors.com >> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust >> Sent: Thursday, August 11, 2011 5:28 PM >> To: Access Developers discussion and problem solving >> Subject: Re: [AccessD] Listbox item Selected property staying false after >> clicking an item >> >> 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 >> >> >> >> -- >> 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