William Benson (VBACreations.Com)
vbacreations at gmail.com
Thu Aug 11 19:45:31 CDT 2011
Initially kicked back as too long . which doesn't seem possible to me but what do I know. From: William Benson (VBACreations.Com) [mailto:vbacreations at gmail.com] Sent: Thursday, August 11, 2011 7:48 PM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Listbox item Selected property staying false after clicking an item Please someone tell me if this is just me . or you get this behavior too. Trust me it is VERY EASY to determine. Just set up a form with a listbox that has columnheader = yes, and enter 3 values of your choice in the Value List (or bind it to a table, doesn't seem to matter which). Add a command button. Here is the code: 'What I find is that clicking items causes the selected 'property to be 0 for every item in the 'listbox . but when clicking the command button, the 'item which is selected is true. So '.Selected is ALWAYS FALSE in the 'AfterUpdate event .. WHYYYYYYYY???????????? Option Compare Database Option Explicit Private Sub Command2_Click() List0_AfterUpdate End Sub Private Sub List0_AfterUpdate() Dim i As Long MsgBox List0.ListIndex For i = 1 To List0.ListCount If List0.Selected(i) Then MsgBox "Item " & i & " is selected" End If Next End Sub