اذهب الي المحتوي
أوفيسنا

مطلوب كود يغلق جميع النماذج والتقارير المفتوحة


elghoultk
إذهب إلى أفضل إجابة Solved by kanory,

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

السلام عليكم ورحمة الله وبركاته
مطلوب كود يغلق جميع النماذج والتقارير المفتوحة من خلال الضغط علي زر في نموذج بحيث لا يتم غلق النموذج الذي به زر الاغلاق هذا
وشكرا مقدما🥰

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

جرب هذا .... 

Sub CloseAllFormsAndReportsExceptOne()
    Dim obj As AccessObject
    For Each obj In CurrentProject.AllForms
        If obj.IsLoaded And Not obj.Name = "FormToKeepOpen" Then
            DoCmd.Close acForm, obj.Name
        End If
    Next obj
    For Each obj In CurrentProject.AllReports
        If obj.IsLoaded And Not obj.Name = "ReportToKeepOpen" Then
            DoCmd.Close acReport, obj.Name
        End If
    Next obj
End Sub

 

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

  • أفضل إجابة

طيب طالما انه زر ... جرب هذا ...

    Dim obj As AccessObject
    For Each obj In CurrentProject.AllForms
        If obj.IsLoaded And Not obj.Name = "FormToKeepOpen" Then
            DoCmd.Close acForm, obj.Name
        End If
    Next obj
    For Each obj In CurrentProject.AllReports
        If obj.IsLoaded And Not obj.Name = "ReportToKeepOpen" Then
            DoCmd.Close acReport, obj.Name
        End If
    Next obj

 

او ادرج مثال مصغر للتطبيق .... 

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

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