I have had a problem in using the .selected property for some time and have been unable to resolve it. Originally when I used the property it would give me a fatal error and drop me out of Access. Currently, it locks up my form, except for the listbox that I am using it from.
I went to Microsoft with the problem and after deleting and reloading Office, the problem was still there so I sent them a sample DB with the problem. Feedback from them was it was a coding problem and would need to go to their professional services group and cost $300. I assume from that they were able to reproduce the problem.
Basically, I have two list boxes - Click on lstSites, populates lstJobs and builds string using a loop thru all the items in lstJobs - this is not how I intend to use it but as a demo of the problem.
Code is as follows:-
............................................................................
Private Sub lstSites_Click()
Dim Jobstring As String
Dim iloop As Integer
Me.lstJobs.Requery
Jobstring = ""
For iloop = 0 To Me.lstJobs.ListCount - 1
Me.lstJobs.Selected(iloop) = True
Jobstring = Jobstring & Me.lstJobs.Column(3) & ";"
Next iloop
Me.JString = Jobstring
End Sub
Private Sub lstJobs_Click()
MsgBox "clicked on Jobs Listbox"
End Sub
.............................................................................
On running the above, I can click on different items in lstSites and it populates lstJobs and Jobstring correctly, but I am unable to select anything else on the form - eg click on lstJobs should show the msgbox box but I locked out.
I was going to attach the demo application but don't have ZIP.
Appreciate any feedback whether it works for you or not.
Thanks in advance.
I went to Microsoft with the problem and after deleting and reloading Office, the problem was still there so I sent them a sample DB with the problem. Feedback from them was it was a coding problem and would need to go to their professional services group and cost $300. I assume from that they were able to reproduce the problem.
Basically, I have two list boxes - Click on lstSites, populates lstJobs and builds string using a loop thru all the items in lstJobs - this is not how I intend to use it but as a demo of the problem.
Code is as follows:-
............................................................................
Private Sub lstSites_Click()
Dim Jobstring As String
Dim iloop As Integer
Me.lstJobs.Requery
Jobstring = ""
For iloop = 0 To Me.lstJobs.ListCount - 1
Me.lstJobs.Selected(iloop) = True
Jobstring = Jobstring & Me.lstJobs.Column(3) & ";"
Next iloop
Me.JString = Jobstring
End Sub
Private Sub lstJobs_Click()
MsgBox "clicked on Jobs Listbox"
End Sub
.............................................................................
On running the above, I can click on different items in lstSites and it populates lstJobs and Jobstring correctly, but I am unable to select anything else on the form - eg click on lstJobs should show the msgbox box but I locked out.
I was going to attach the demo application but don't have ZIP.
Appreciate any feedback whether it works for you or not.
Thanks in advance.