Hello,
I browsed through several topics in the thread. The closet one that I came out was: thread702-1109346.
My issue is very similar to the previous post. I created a form, "frmProject", with an unbound listbox. This listbox has a column count of 2, Project_ID and Project_Name. I had already changed the "multi select" to "extended" per the thread. The data comes from table, tblProjects.
Proj_ID's property is numeric and Proj_Name is String. The first column is the Proj_ID and second column is Proj_Name.
I also created a button to run the code, which I tried to replicate from the previous thread.
************************
Option Compare Database
Option Explicit
Sub TestProjects()
Dim sProject As Double
Dim i As Integer
Dim sSearch As Double ' Uncertain whether to use the string or double.
sSearch = Null ' uncertain regarding "" from the examples.
For i = 0 To Me.List2.ItemsSelected.Count - 1
'sSearch = sSearch & Chr(34) & Me.List2.ItemData(Me.list2.ItemSelected(i)) & Chr(34) & ","
(I think the sSearch is incorrect. Need help on this as well.)
Next i
sWhere = "((tblProjects.Proj_ID, tblProjects.Project_Name) in (" & sSearch & "))"
DoCmd.OpenReport , "rptProjectsReport", acViewPreview, , sSearch
End Sub
***************
Requests:
1. When I tried to execute the code, the program does not recognize "Me," (Invalid use of Me Keyword.) Please correct.
2. Please do not link to other Microsoft threads or outside the forum because the codes are too long and they are very confusing.
Thanks.
I browsed through several topics in the thread. The closet one that I came out was: thread702-1109346.
My issue is very similar to the previous post. I created a form, "frmProject", with an unbound listbox. This listbox has a column count of 2, Project_ID and Project_Name. I had already changed the "multi select" to "extended" per the thread. The data comes from table, tblProjects.
Proj_ID's property is numeric and Proj_Name is String. The first column is the Proj_ID and second column is Proj_Name.
I also created a button to run the code, which I tried to replicate from the previous thread.
************************
Option Compare Database
Option Explicit
Sub TestProjects()
Dim sProject As Double
Dim i As Integer
Dim sSearch As Double ' Uncertain whether to use the string or double.
sSearch = Null ' uncertain regarding "" from the examples.
For i = 0 To Me.List2.ItemsSelected.Count - 1
'sSearch = sSearch & Chr(34) & Me.List2.ItemData(Me.list2.ItemSelected(i)) & Chr(34) & ","
(I think the sSearch is incorrect. Need help on this as well.)
Next i
sWhere = "((tblProjects.Proj_ID, tblProjects.Project_Name) in (" & sSearch & "))"
DoCmd.OpenReport , "rptProjectsReport", acViewPreview, , sSearch
End Sub
***************
Requests:
1. When I tried to execute the code, the program does not recognize "Me," (Invalid use of Me Keyword.) Please correct.
2. Please do not link to other Microsoft threads or outside the forum because the codes are too long and they are very confusing.
Thanks.