Is there any way by which one can Detect the Corruption
of Ms Access database (mdb) before it gets corrupted and
repair is required. There by avoiding inconvenience to the
user
Curruption useally takes place when a user is shutting down in the middle of an update i.e. reset etc. so I do not think that one can detect this in advance.
Curruption in A2K and AXP are not common but in A97 etc. it was "normal".
I you want to ensure a no curruption back-end you could think about using an SQL back-end for your MDB via an ODBC, by upsizing your back-end to SQL - if your client does not use or du not want to invest in an SQL-server use an MSDE (run-time-SQL-server).
Herman
If you have a corrupt database when you try to open in DAO the error #3343 (Access 97) is display and description of the name and the path of database corrupted. Finaly i extract the name and the path from description i pass in the Function to Repair and Compact DB.
Private Function MyFunction()
Dim bRetry as Boolean
On Error Goto MyFunction_Err
Set db= OpenDatabase("C:\Test\DBCorrupt.mdb"
etc...
db.close:set db = nothing
Exit Function
MyFunction_Err:
DisplayErrorMessage Err.Number, Err.Description, "MyFunction", bRetry
Err.Clear
if bRetry then Resume
set db = nothing
End Function
Public Sub DisplayErrorMessage(varErrorNum As Variant, strDescription As String, strSubFunctionName As String, bRetry As Boolean)
Const ERR_BD_CORRUPTION As Variant = 3343
If varErrorNum = ERR_BD_CORRUPTION Then
'Extract Path and Database Name from Description.
For iCounterX = 1 To Len(strDescription) - 5
If MID(strDescription, iCounterX, 5) = ".mdb'" Then
Exit For
End If
Next iCounterX
For iCounterY = iCounterX To 1 Step -1
If MID(strDescription, iCounterY, 1) = "'" Then
iCounterY = iCounterY + 1
Exit For
End If
Next iCounterY
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.