Hi everyone, I'd be grateful for any assistance...
I have 9 listboxes ("list1", "list2", "list3", etc..) that are lined up on a form. When a user clicks on one of them, I need all the other listboxes to have the same index value be selected as well. This works well with a for...next loop, and is programmed in a procedure called "highlight". When I click on any of these listboxes, a different lisbox "Dest" is suppsed to update based on the value I picked. This also works fine. The problem comes when I try to click on the new values in the "Dest" listbox. I have to click twice to get it to make a selection. I've tried different things, including Me.Dest.setfocus - but this just gives an error that Access Cannot Change Focus.
Here is code that I've greatly condensed to try and diagnose the problem (unsuccessfully):
Option Compare Database
Dim sqltest As String
Dim i As Integer
-----------------------------------
Private Sub List1_Click()
lstnum = 1
i = Me.List1.ListIndex
Highlight
End Sub
---------------------------------
Private Sub List2_Click()
lstnum = 2
i = Me.List2.ListIndex
Highlight
End Sub
--------------------------------------
Private Sub List3_Click()
lstnum = 3
i = Me.List3.ListIndex
Highlight
End Sub
--------------------------------------------
Private Sub Highlight()
Dim lstctrl As Control
Dim cnt As Integer
For cnt = 1 To 3
Set lstctrl = Me("list" & Format(cnt, "0"))
lstctrl.Selected(i) = True
Next
sqltest = "SELECT [ZIP Territory].ID FROM [ZIP Territory]"
Me.dest.RowSource = sqltest
Me.dest.Requery
End Sub
-------------------------------------------
Does anyone know what I have to do in order to be able to click on the Dest listbox only once in order to get it to make a selection. Normally when there are multiple listboxes on a form, one can jump back and forth between them with no "coughs" of extra clicks such as this. This jumping still works with the list1, list2, etc... boxes, just not the Dest box (in which I've changed the rowsource)
I have 9 listboxes ("list1", "list2", "list3", etc..) that are lined up on a form. When a user clicks on one of them, I need all the other listboxes to have the same index value be selected as well. This works well with a for...next loop, and is programmed in a procedure called "highlight". When I click on any of these listboxes, a different lisbox "Dest" is suppsed to update based on the value I picked. This also works fine. The problem comes when I try to click on the new values in the "Dest" listbox. I have to click twice to get it to make a selection. I've tried different things, including Me.Dest.setfocus - but this just gives an error that Access Cannot Change Focus.
Here is code that I've greatly condensed to try and diagnose the problem (unsuccessfully):
Option Compare Database
Dim sqltest As String
Dim i As Integer
-----------------------------------
Private Sub List1_Click()
lstnum = 1
i = Me.List1.ListIndex
Highlight
End Sub
---------------------------------
Private Sub List2_Click()
lstnum = 2
i = Me.List2.ListIndex
Highlight
End Sub
--------------------------------------
Private Sub List3_Click()
lstnum = 3
i = Me.List3.ListIndex
Highlight
End Sub
--------------------------------------------
Private Sub Highlight()
Dim lstctrl As Control
Dim cnt As Integer
For cnt = 1 To 3
Set lstctrl = Me("list" & Format(cnt, "0"))
lstctrl.Selected(i) = True
Next
sqltest = "SELECT [ZIP Territory].ID FROM [ZIP Territory]"
Me.dest.RowSource = sqltest
Me.dest.Requery
End Sub
-------------------------------------------
Does anyone know what I have to do in order to be able to click on the Dest listbox only once in order to get it to make a selection. Normally when there are multiple listboxes on a form, one can jump back and forth between them with no "coughs" of extra clicks such as this. This jumping still works with the list1, list2, etc... boxes, just not the Dest box (in which I've changed the rowsource)