JetComp and a Damaged DB

G

Guest

I have a corrupted back end. How who knows. I had a backup (I thought). But
it seems it is doing something weird since it was backed up this morning. I
tried to Compact and repair, nothing. I tried JetComp, it goes about half
way, then it does nothing. I tried creating a new database and importing the
objects over, on one object (the main table), i get the same error every
time. "Record Deleted". I can open the table, I can use find, but I can't
filter or sort because it gives me this error. Any suggestions?
 
T

Tom Wickerath

I have a corrupted back end. How who knows.
Allen Browne and Tony Toews offer lots of information about the causes of database corruption:

http://members.iinet.net.au/~allenbrowne/ser-25.html

http://www.granite.ab.ca/access/corruptmdbs.htm


You can try the method shown in this KB article:

How to Recover Data from a Corrupted Table by Using the DAO Method
http://support.microsoft.com/?id=815280

If that doesn't work, then try the following posted by Frank Miller, Microsoft Support Group, as
a method of recovering tables & queries
http://groups.google.com/[email protected]

You can also try recovering one record at a time, by opening two recordsets: one to read the
record from the table with corruption and one to write the record to your new table. Use an error
handler to record the primary key value for any records that generate an error when attempting to
read them into the first recordset (assuming you can read this value). Then display a message box
at the end that includes any primary key values for records that could not be read. Somewhere, I
have seen a procedure similar to this, but I cannot seem to find it at the moment.

Tom
______________________________


I have a corrupted back end. How who knows. I had a backup (I thought). But
it seems it is doing something weird since it was backed up this morning. I
tried to Compact and repair, nothing. I tried JetComp, it goes about half
way, then it does nothing. I tried creating a new database and importing the
objects over, on one object (the main table), i get the same error every
time. "Record Deleted". I can open the table, I can use find, but I can't
filter or sort because it gives me this error. Any suggestions?
 
G

Guest

I tried the first option but could not get it to work. But the second otion
work fine. It imported everthing except the corrupted table.
Below is the code I used;
Dim dbCorrupt As DAO.Database
Dim dbCurrent As DAO.Database
Dim td As DAO.TableDef
Dim tdNew As DAO.TableDef
Dim fld As DAO.Field
Dim fldNew As DAO.Field
Dim ind As DAO.Index
Dim indNew As DAO.Index
Dim qd As DAO.QueryDef
Dim qdNew As DAO.QueryDef
Dim strDBPath As String
Dim strQry As String


'Replace the path below to the path of the corrupted database


strDBPath = "C:\Documents and
Settings\mbottema\Desktop\DB072604_be.mdb"
On Error Resume Next
Set dbCurrent = CurrentDb
Set dbCorrupt = OpenDatabase(strDBPath)
For Each td In dbCorrupt.TableDefs
If Left(td.Name, 4) <> "MSys" Then


strQry = "SELECT * INTO [" & td.Name & "] FROM [" &
td.Name & "] IN '" & dbCorrupt.Name & "'"
dbCurrent.Execute strQry, dbFailOnError
dbCurrent.TableDefs.Refresh
Set tdNew = dbCurrent.TableDefs(td.Name)

'Recreate the indexes on the table


For Each ind In td.Indexes
Set indNew = tdNew.CreateIndex(ind.Name)
For Each fld In ind.Fields
Set fldNew = indNew.CreateField(fld.Name)
indNew.Fields.Append fldNew
Next
indNew.Primary = ind.Primary
indNew.Unique = ind.Unique
indNew.IgnoreNulls = ind.IgnoreNulls
tdNew.Indexes.Append indNew
tdNew.Indexes.Refresh
Next
End If
Next


'Recreate the queries


For Each qd In dbCorrupt.QueryDefs
If Left(qd.Name, 4) <> "~sq_" Then
Set qdNew = dbCurrent.CreateQueryDef(qd.Name, qd.SQL)
End If
Next
dbCorrupt.Close
Application.RefreshDatabaseWindow


MsgBox "Procedure Complete."
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top