نعم هو ما تفضلت به
عملت لك كودا آخر يحدد الفوج ايضا هكذا
وانظر الى المعيار في سطر فتح التقرير
Dim myWhere As String
Dim intNumColumns As String
Private Sub funGrop()
Dim varItem As Variant
myWhere = ""
For Each varItem In Me.lst_XX.ItemsSelected
myWhere = myWhere & "'" & Me.lst_XX.ItemData(varItem) & "', "
Next varItem
myWhere = Left(myWhere, Len(myWhere) - 2)
End Sub
Private Sub fungrid()
On Error Resume Next
Dim varItem As Variant
intNumColumns = ""
If Me.lst_XX.ItemsSelected.Count > 0 Then
For Each varItem In Me.lst_XX.ItemsSelected
intNumColumns = intNumColumns & "'" & Me.lst_XX.Column(1, varItem) & "', "
Next varItem
intNumColumns = Left(intNumColumns, Len(intNumColumns) - 2)
End If
End Sub
Private Sub cmd_Preview_Click()
Call funGrop
Call fungrid
DoCmd.OpenReport "rap_stat_situat", acViewPreview, , "[groupe] in (" & intNumColumns & ")" & "And [grade] in (" & myWhere & ")"
End Sub
basey_2023.rar