J
Jose
I wish to open a report from the multiple values i have selected in 2
different list boxes. Name of list boxes are List24 and List 27. List24
showing the supervisor (MWC) and List27 the plants.
Please see the following code and instruct me how can i add the code
for list27 also
Dim varItem As Variant 'Selected items
Dim strWhere As String 'String to use as WhereCondition
Dim strDescrip As String 'Description of WhereCondition
Dim lngLen As Long 'Length of string
Dim strDelim As String 'Delimiter for this field type.
Dim strDoc As String 'Name of report to open.
strDelim = """"
strDoc = "Incomplete Jobs Query"
With Me.List24
For Each varItem In .ItemsSelected
If Not IsNull(varItem) Then
strWhere = strWhere & strDelim & .ItemData(varItem) &
strDelim & ","
End If
Next
End With
lngLen = Len(strWhere) - 1
If lngLen > 0 Then
strWhere = "[MWc] IN (" & Left$(strWhere, lngLen) & ")"
End If
If CurrentProject.AllReports(strDoc).IsLoaded Then
DoCmd.Close acReport, "Maint Jobs Report"
End If
DoCmd.OpenReport "Maint Jobs Report", acViewPreview,
WhereCondition:=strWhere
different list boxes. Name of list boxes are List24 and List 27. List24
showing the supervisor (MWC) and List27 the plants.
Please see the following code and instruct me how can i add the code
for list27 also
Dim varItem As Variant 'Selected items
Dim strWhere As String 'String to use as WhereCondition
Dim strDescrip As String 'Description of WhereCondition
Dim lngLen As Long 'Length of string
Dim strDelim As String 'Delimiter for this field type.
Dim strDoc As String 'Name of report to open.
strDelim = """"
strDoc = "Incomplete Jobs Query"
With Me.List24
For Each varItem In .ItemsSelected
If Not IsNull(varItem) Then
strWhere = strWhere & strDelim & .ItemData(varItem) &
strDelim & ","
End If
Next
End With
lngLen = Len(strWhere) - 1
If lngLen > 0 Then
strWhere = "[MWc] IN (" & Left$(strWhere, lngLen) & ")"
End If
If CurrentProject.AllReports(strDoc).IsLoaded Then
DoCmd.Close acReport, "Maint Jobs Report"
End If
DoCmd.OpenReport "Maint Jobs Report", acViewPreview,
WhereCondition:=strWhere