منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : خطأ في ضغط وإصلاح قاعدة البيانات
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
تقبل الله منا ومنكم صالح الأعمال

هذا مثال صغير المطلوب تعديل الخطأ عند محاولة ضغط وإصلاح قاعدة البيانات
حاولتُ كثيراً لكنني لم أعرف أين يكمن الخطأ فالرجاء التعديل عليه بارك الله فيكم

[attachment=27967]
كل عام و انت بخير
ماهي رسالة الخطأ؟
حملت المثال وحدثت اخطاء لا علاقة لها بالسؤال بل بمسالة الادوات.
الكلاس التالي يعمل معي بشكل جيد
PHP كود :
Public Sub comp(ByVal sdb As StringByVal sDBtmp As StringOptional ByVal pass As String "")
On Error GoTo r:
If 
con.State 1 Then con.Close
If rs.State 1 Then rs.Close

Dim oApp 
As Access.Application
Set oApp 
= New Access.Application
If Trim$(pass) = "" Then
Call oApp
.DBEngine.CompactDatabase(sdbsDBtmp)
'wait for the app to finish
        DoEvents
'
remove the uncompressed original
        Kill sdb
'rename the compressed file to the original to restore for other functions
        Name sDBtmp As sdb
Else
Call oApp.DBEngine.CompactDatabase(sdb, sDBtmp, dbLangGeneral, , ";pwd=" & sPASSWORD)
'
wait for the app to finish
        DoEvents
'remove the uncompressed original
        Kill sdb
'
rename the compressed file to the original to restore for other functions
        Name sDBtmp 
As sdb

End 
If
MsgBox "تم الضغط بنجاح"vbInformation"ضغط ملف"
Exit Sub
r
:
MsgBox Err.DescriptionvbCritical"ضغط ملف"
Err.Clear
End Sub 
وطريقة استخدامه الكود التالي:
PHP كود :
Dim co As New Class1
 co
.comp App.Path "\phone.accdb"App.Path "\NDB.accdb" 
بارك خوي سعود تم حل المشكلة من خلال المثال المرفق
(10-07-22, 09:37 PM)مصمم هاوي كتب : [ -> ]بارك خوي سعود تم حل المشكلة من خلال المثال المرفق

 و فيك بارك الله.