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

كيف أعمل زر لضغط قاعدة البيانات وإصلاحها


GNMQ8

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

السلام عليكم ورحمة الله وبركاته

نعم أخي GNMQ8 ،

تضع هذا الكود خلف النموذج الذي فيه الزر

 

Function RepairDatabase(strSource As String, _
        strDestination As String) As Boolean
        ' Input values: the paths and file names of
        ' the source and destination files.

    ' Trap for errors.
    On Error GoTo error_handler

    ' Compact and repair the database. Use the return value of
    ' the CompactRepair method to determine if the file was
    ' successfully compacted.
    RepairDatabase = _
        Application.CompactRepair( _
        LogFile:=True, _
        SourceFile:=strSource, _
        DestinationFile:=strDestination)

    ' Reset the error trap and exit the function.
    On Error GoTo 0
    Exit Function

' Return False if an error occurs.
error_handler:
    RepairDatabase = False

End Function
وفي حدث الزر تطلب الكود السابق هكذا
Private Sub cmd_Click()
If RepairDatabase("c:\a.mdb", "c:\b.mdb") = True Then MsgBox "تمت العملية"
End Sub

هذا بدوره يعمل ضغط واصلاح للقاعدة a وينتج القاعدة المضغوطة b وذلك في جهاز التخزين c

compact.zip

مع وافر الاحترام

تم تعديل بواسطه محب العلم
رابط هذا التعليق
شارك

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