UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> set as unselected in listbox    
 
   
jon_a
post Feb 8 2009, 06:18 AM
Post #1

UtterAccess Veteran
Posts: 367
From: Gateshead. ENGLAND



I have the following code in my on double click section of a list box, this works fine but i need to ensure after the double click that the item remains unselected.

CODE

            Me.txtLbox1 = lbox1.Column(0)
            DoCmd.OpenForm "frmLessonTaskDisplay", , , , acFormReadOnly, acDialog
Go to the top of the page
 
+
Alan_G
post Feb 8 2009, 07:08 AM
Post #2

Utterly Yorkshire and Forum/Wiki Editor
Posts: 15,895
From: Devon UK



Try........

CODE
Dim intX As Integer
Me.txtLbox1 = Me.lbox1.Column(0)            
For intX = 0 To Me.lbox1.ListCount - 1
   Me.lbox1.Selected(intX) = False
Next intX
DoCmd.OpenForm "frmLessonTaskDisplay", , , , acFormReadOnly, acDialog
Go to the top of the page
 
+
jon_a
post Feb 8 2009, 05:40 PM
Post #3

UtterAccess Veteran
Posts: 367
From: Gateshead. ENGLAND



Will that not deselect everything? I only want it to deselect the one that has been double clicked on
Go to the top of the page
 
+
Alan_G
post Feb 8 2009, 06:19 PM
Post #4

Utterly Yorkshire and Forum/Wiki Editor
Posts: 15,895
From: Devon UK



Are you using a multiselect or single select listbox ?

If it's not multi select, you can use....

CODE
Dim intX As Integer
Me.txtLbox1 = Me.lbox1.Column(0)            
intX = Me.txtLbox1.ListIndex
Me.lbox1.Selected(intX) = False
DoCmd.OpenForm "frmLessonTaskDisplay", , , , acFormReadOnly, acDialog
Go to the top of the page
 
+
jon_a
post Feb 8 2009, 06:47 PM
Post #5

UtterAccess Veteran
Posts: 367
From: Gateshead. ENGLAND



thanks alan but i am using multi select. I bet that makes things hard.lol
Go to the top of the page
 
+
Alan_G
post Feb 8 2009, 07:05 PM
Post #6

Utterly Yorkshire and Forum/Wiki Editor
Posts: 15,895
From: Devon UK



Sorry, you need to give me a bit more info then........ (IMG:http://www.utteraccess.com/forum/style_emoticons/default/wink.gif)

With a multi select listbox, if it's set to Extended, then the very act of double clicking will deselect all selections except the one you've double clicked. If it's set to Simple then double clicking an item that's already selected will deselect it, and double clicking an unselected item will select it............

What is it exactly you want to do ?
Go to the top of the page
 
+
jon_a
post Feb 8 2009, 08:24 PM
Post #7

UtterAccess Veteran
Posts: 367
From: Gateshead. ENGLAND



ok i have set the list box to multi select simple. what is supposed to happen is on double click a second form opens displaying some information, but on closing the newly opened form i want the selection i double clicked to be unselected. It is not an integral part of my DB but is a nice to have the knowledge.
Go to the top of the page
 
+
Alan_G
post Feb 8 2009, 08:48 PM
Post #8

Utterly Yorkshire and Forum/Wiki Editor
Posts: 15,895
From: Devon UK



Hi

The code I posted before should be what you want then, with a couple of lines switched round...........

CODE
Dim intX As Integer
Me.txtLbox1 = Me.lbox1.Column(0)            
intX = Me.txtLbox1.ListIndex
DoCmd.OpenForm "frmLessonTaskDisplay", , , , acFormReadOnly, acDialog
Me.lbox1.Selected(intX) = False


**untested air code
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th June 2013 - 12:21 AM