W
Will G
Hello, i am really new with access and i like to make a few adjustments to
my selection on a list. right at this moment, i have a multiselection list
and what it does with the code bellow is when i select a OrderNo, and print
result it will prints all OrderNos. to be more clear i will give an
example..........in the list row i have OrderNo, RequiredDate, CustomerID,
Comment, ProductID, Desc....and right now i have a criteria of OrderNo...
OrderNo | RequiredDate | CustomerID | Comment | ProductID| Desc
4001 4/6/07 MSC ANY A002
ANY
4001 4/5/07 VSC ANY1 A003
ANY
4001 4/5/07 VCC ANY A003
ANY
4444 4/6/07 MSC ANY A004
ANY
right now, if i select the first 4001 and 4444, i get all 4001s and 4444son
my report. i like to get just what i selected. do anyone know how to do
this....my code look like this.
strDoc = "rptProduction"
strLabel = "rptProductionLabel"
'Loop through the ItemsSelected in the list box.
If Me.sched.ItemsSelected.Count = 0 Then
Beep
MsgBox "no item selected ", 48
Exit Sub
End If
With Me.sched
For Each varItem In .ItemsSelected
If Not IsNull(varItem) Then
'Build up the filter from the bound column (hidden).
strWhere = strWhere & strDelim & .ItemData(varItem) &
strDelim & ","
'Build up the description from the text in the visible
column. See note 2.
'strDescrip = strDescrip & """" & .Column(1, varItem) & """, "
End If
Next
End With
lngLen = Len(strWhere) - 1
If lngLen > 0 Then
strWhere = "[OrderNo] IN (" & Left$(strWhere, lngLen) & ")"
lngLen = Len(strDescrip) - 4
If lngLen > 0 Then
'strDescrip = "Production Required: " & Left$(strDescrip, lngLen)
End If
End If
If CurrentProject.AllReports(strDoc).IsLoaded Then
DoCmd.close acReport, strDoc
End If
DoCmd.OpenReport strDoc, acViewPreview, WhereCondition:=strWhere,
OpenArgs:=strDescrip
my selection on a list. right at this moment, i have a multiselection list
and what it does with the code bellow is when i select a OrderNo, and print
result it will prints all OrderNos. to be more clear i will give an
example..........in the list row i have OrderNo, RequiredDate, CustomerID,
Comment, ProductID, Desc....and right now i have a criteria of OrderNo...
OrderNo | RequiredDate | CustomerID | Comment | ProductID| Desc
4001 4/6/07 MSC ANY A002
ANY
4001 4/5/07 VSC ANY1 A003
ANY
4001 4/5/07 VCC ANY A003
ANY
4444 4/6/07 MSC ANY A004
ANY
right now, if i select the first 4001 and 4444, i get all 4001s and 4444son
my report. i like to get just what i selected. do anyone know how to do
this....my code look like this.
strDoc = "rptProduction"
strLabel = "rptProductionLabel"
'Loop through the ItemsSelected in the list box.
If Me.sched.ItemsSelected.Count = 0 Then
Beep
MsgBox "no item selected ", 48
Exit Sub
End If
With Me.sched
For Each varItem In .ItemsSelected
If Not IsNull(varItem) Then
'Build up the filter from the bound column (hidden).
strWhere = strWhere & strDelim & .ItemData(varItem) &
strDelim & ","
'Build up the description from the text in the visible
column. See note 2.
'strDescrip = strDescrip & """" & .Column(1, varItem) & """, "
End If
Next
End With
lngLen = Len(strWhere) - 1
If lngLen > 0 Then
strWhere = "[OrderNo] IN (" & Left$(strWhere, lngLen) & ")"
lngLen = Len(strDescrip) - 4
If lngLen > 0 Then
'strDescrip = "Production Required: " & Left$(strDescrip, lngLen)
End If
End If
If CurrentProject.AllReports(strDoc).IsLoaded Then
DoCmd.close acReport, strDoc
End If
DoCmd.OpenReport strDoc, acViewPreview, WhereCondition:=strWhere,
OpenArgs:=strDescrip