اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

طريقة عرض التقارير


jamal2080

الردود الموصى بها

اريد تعديل الكود لان يوجود خطاء لم اتمكن من حل المشاكل ....

Private Sub cmdpro_04_Click()
On Error Resume Next

    Dim reports() As Variant
    Dim i As Integer

    ' تعريف أسماء التقارير
    reports = Array("Month_RQ", "Month_RQ_01", "Month_RQ_02", "Month_RQ_03")

    ' فحص وجود بيانات في كل تقرير قبل فتحه
    For i = LBound(reports) To UBound(reports)
        If ReportHasData(reports(i)) Then
            DoCmd.OpenReport reports(i), acViewPreview
        Else
            MsgBox "لا توجد بيانات لفتح التقرير: " & reports(i)
        End If
    Next i

End Sub
' دالة للتحقق من وجود بيانات في تقرير محدد
Function ReportHasData(reportName As String) As Boolean
On Error Resume Next
   Dim RS As Recordset

    ' فتح التقرير واستنساخ السجلات
    Set RS = reports(reportName).RecordsetClone

    ' التحقق من وجود سجلات
    If Not RS.EOF Then
        ReportHasData = True
    End If

    ' إغلاق السجلات
    RS.Close
    Set RS = Nothing
End Function

 

رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information