detecting a corrupt record

soundsfishy

Registered User.
Local time
Tomorrow, 01:04
Joined
Sep 25, 2002
Messages
174
Is there any way I can find which record is corrupting a table.

The corrupted record is causing problems in importing the table to another DB and as well as compacting.

Any help would be appreciated.
 
Is this of any use?

http://www.mvps.org/access/tables/tbl0018.htm

First, using Access while in the database window, copy the table's structure only from the corrupt table, if possible. Then using the code below, copy each individual row from the old table to the new one until it encounters an error. The error routine displays the error, skips one row, moves to the next and Resumes at Addit where it continues to move data from the old table to the new table one row at a time.


' ********* Code Start ***********
' This code was originally written by Norm Chezem
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Norm Chezem
'
Function CopyRes()
Dim db As Database
Dim OldRes As Recordset
Dim NewRes As Recordset
Dim ErrMsg1 As String
Dim RecCount As Long
On Error GoTo err_Proc
Set db = CurrentDb()
Set OldRes = db.OpenRecordset("tbl_Reservations")
Set NewRes = db.OpenRecordset("tbl_New_Res")
RecCount = 0
OldRes.MoveFirst
Do While Not OldRes.EOF
Addit:
NewRes.AddNew
NewRes![ResID] = OldRes![ResID]
'CONTINUE COPYING ALL ROWS FROM OLD TBL TO NEW
NewRes.Update
RecCount = RecCount + 1
DoEvents
If RecCount Mod 10000 = 0 then
MsgBox RecCount 'Show progress every 10,000 rows
End If
Loop
MsgBox RecCount 'Show total successful record count
OldRes.Close
NewRes.Close
db.close
Proc_Exit:
Exit Function
Err_Proc:
MsgBox "<Error>" & Error$
OldRes.MoveNext 'Skip this corrupt row
Resume Addit 'Continue at Addit
End Function
' ********* Code End ***********
 
I had a problem with actually running a form in a DB a while back and finally out of desperation went to a previously saved version of the DB (I always save three incremental copies), deleting the DATA from the table the form pulled from, and imported the data to the backup version. I don't remember what the problem was now, but Access pinpointed it when the record or given field didn't import correctly.

The Missinglinq
 
Wow! thanks for that guys. I'll keep the code in my emergency kit!

The problem had was #error in a memo field.

you've saved me from cutting my wrists over this problem..:-)

Im glad that there was a solution.

I wish I knew how to prevent such problems in the future.

Like they say " prevention is better than the cure".
 
Last edited:
The memo type field does seem to be the most succeptable one for this type of problem. I think it is related to a network issue but have never been able to establish what. As a work around where possible use a text field length 255.
 
Woody,

Yes it does seem as though the corruption occurs in the memo field in every one Ive had so far. Using a text box many be the best prevention for this.

I wish I could use a text box but we have often write case notes for the client and 255 is not enough characters. I need least 500-700.
 

Users who are viewing this thread

Back
Top Bottom