للاسف بعد ماتاكدة جيدا اتضح بعد التجربة ان لم ينجع مع التقرير 1 الفارغ ولم يظهر ارجو التحقق من الكود
ممكن تجرب هذا
Private Sub Commande24_Click()
Dim varcode As String
Dim vars As String
Dim ContRec As Integer
ContRec = DCount("code", "listecont", "[code]='" & Me.code & "'")
Debug.Print "ContRec >> " & ContRec
If Me.code.Value <> "" Then
varcode = "'" & Me.code.Value & "'"
If x <> "" Then
x = x & " and "
End If
x = x & "code = " & varcode & " "
End If
'If Nz(DLookup("mtRole", "listecont", "code='" & Forms!Chrche_Filter!code & "'"), 0) <> 0 Then
'
' DoCmd.OpenReport "data", acViewPreview, , x
'Else
' DoCmd.OpenReport "nodata", acViewPreview, , x
'End If
If ContRec <= 0 Then
DoCmd.OpenReport "nodata", acViewPreview, , x
ElseIf ContRec >= 1 And ContRec <= 17 Then
DoCmd.OpenReport "data", acViewPreview, , x
ElseIf ContRec >= 18 And ContRec <= 999999999 Then
DoCmd.OpenReport "data", acViewPreview, , x
End If
End Sub
شكرا لك اخ عمر ضاحي فلا هذه المرة اشتغل معايا