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

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

قام بنشر

السلام عليكم

كيف نُصدر (نستخرج) المرفقات الموجودة في حقل معين في أكسس إلى مجلد خارجي

قام بنشر

وعليكم السلام

تفضل اخي الكريم

Public Sub ExportAttachments()
    Dim rs As DAO.Recordset
    Dim attachmentField As DAO.Field2
    Dim attachmentRS As DAO.Recordset2
    Dim attachmentCount As Long
    Dim attachmentPath As String

    attachmentPath = CurrentProject.Path & "\Saving\"
    Set rs = CurrentDb.OpenRecordset("Table1")
    If Not (rs.EOF And rs.BOF) Then
        rs.MoveFirst
        Do Until rs.EOF
            Set attachmentField = rs.Fields("Attachments")
            If Not attachmentField.Value Is Nothing Then
                Set attachmentRS = attachmentField.Value
                For attachmentCount = 1 To attachmentRS.RecordCount
                    If Not FileExists(attachmentPath & attachmentRS.Fields("FileName")) Then
                        attachmentRS.Fields("FileData").SaveToFile attachmentPath & attachmentRS.Fields("FileName")
                        MsgBox "تم تصدير الملفات التالية: " & attachmentPath & attachmentRS.Fields("FileName"), vbInformation, "تمت عملية التصدير بنجاح "

                    Else
                        MsgBox "الملف موجود مسبقا تم إلغاء عملية التصدير: " & attachmentPath & attachmentRS.Fields("FileName"), vbCritical, "تم إلغاء عملية التصدير "
                    End If
                    attachmentRS.MoveNext
                Next attachmentCount
            End If
            rs.MoveNext
        Loop
    End If
    rs.Close
    Set rs = Nothing
    Set attachmentRS = Nothing
End Sub

Function FileExists(filePath As String) As Boolean
    FileExists = Dir(filePath) <> ""
End Function

 'والاستدعاء
Private Sub Command3_Click()
    ExportAttachments
End Sub

وهذا ملف من  عندي

بالتوفيق

تصدير المرفقات الى ملف خارجي.rar

انشئ حساب جديد او قم بتسجيل دخولك لتتمكن من اضافه تعليق جديد

يجب ان تكون عضوا لدينا لتتمكن من التعليق

انشئ حساب جديد

سجل حسابك الجديد لدينا في الموقع بمنتهي السهوله .

سجل حساب جديد

تسجيل دخول

هل تمتلك حساب بالفعل ؟ سجل دخولك من هنا.

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

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

Important Information