G
Guest
Hello, I am having so much trouble with the multi select list box on a form.
I want to be able to select a few names from the list box and have it run a
query which brings up a report. I just cant figure out the code for the list
box. The list box name is "list1" and my report name is
"rpt_EmployeeComparison" and my query for the report is
qry_EmployeeComparison if that matters. Here is the code I have in the button
for the list box as of now and it works but its bringing up all the names in
the list box because I dont have the code for the multiselct. What and where
in the code I have as of now would I add? Thanks!!
Private Sub cmdEmployeeComparison_Click()
On Error GoTo Err_cmdEmployeeComparison_Click
Dim stDocName As String
Dim stLinkCriteria As String
If ValidDates() Then
If Me.list1 & "" <> "" Then
stDocName = "rpt_EmployeeComparison"
DoCmd.OpenReport stDocName, acPreview
Else
MsgBox "Select Employee for Individual Reports.", vbOKOnly,
"Employee Not Selected"
End If
End If
Exit_cmdEmployeeComparison_Click:
Exit Sub
Err_cmdEmployeeComparison_Click:
MsgBox Err.Description
Resume Exit_cmdEmployeeComparison_Click
End Sub
I want to be able to select a few names from the list box and have it run a
query which brings up a report. I just cant figure out the code for the list
box. The list box name is "list1" and my report name is
"rpt_EmployeeComparison" and my query for the report is
qry_EmployeeComparison if that matters. Here is the code I have in the button
for the list box as of now and it works but its bringing up all the names in
the list box because I dont have the code for the multiselct. What and where
in the code I have as of now would I add? Thanks!!
Private Sub cmdEmployeeComparison_Click()
On Error GoTo Err_cmdEmployeeComparison_Click
Dim stDocName As String
Dim stLinkCriteria As String
If ValidDates() Then
If Me.list1 & "" <> "" Then
stDocName = "rpt_EmployeeComparison"
DoCmd.OpenReport stDocName, acPreview
Else
MsgBox "Select Employee for Individual Reports.", vbOKOnly,
"Employee Not Selected"
End If
End If
Exit_cmdEmployeeComparison_Click:
Exit Sub
Err_cmdEmployeeComparison_Click:
MsgBox Err.Description
Resume Exit_cmdEmployeeComparison_Click
End Sub