تفضل يا سيدي 🙂
النموذج والاستعلام هكذا :
.
وزر "عرض التقرير" يحتوي على هذا الكود في حدث النقر:
Private Sub cmd_Preview_Click()
Dim varItem As Variant
Dim myWhere As String
myWhere = ""
' Loop through the selected items in the ListBox
For Each varItem In Me.lst_XX.ItemsSelected
' Add each selected item to the string
myWhere = myWhere & "'" & Me.lst_XX.ItemData(varItem) & "', "
Next varItem
' Remove the trailing comma and space from the string
myWhere = Left(myWhere, Len(myWhere) - 2)
'هذه الفقرة الاخيرة بتعطينا المواد التي تم اختيارها بهذا التنسيق:
'الإقتصادية', 'الادارية', 'التربوية'
DoCmd.OpenReport "qry_Section_Gender_Count", acViewPreview, , "[Section] in (" & myWhere & ")"
'والامر النهائي يصبح هكذا:
'DoCmd.OpenReport "qry_Section_Gender_Count", acViewPreview, , "[Section] in ('الإقتصادية', 'الادارية', 'التربوية')"
End Sub
.
والنتيجة:
جعفر
1563.baseNN.accdb.zip