473,405 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Compact/Repair corrupts table

Hi there,
One table is corrupted. I found compacting is the cause or triggers
the process. I have the solution to repair the wrong records but after
each compact the same table is corrupted again at the same place.
After repairing the table by cutting rows and appending data from
outside (sql from coldfusion or from Excel), user may appends row(s)
in this table. Until compacting everything is fine with those new
records. After compacting, the table opens great but any process using
this table makes db crashing (Access Not Responding). Does anyone can
help on the cause? Thanks.

Sep 13 '07 #1
2 2015
Wally wrote:
Hi there,
One table is corrupted. I found compacting is the cause or triggers
the process. I have the solution to repair the wrong records but after
each compact the same table is corrupted again at the same place.
After repairing the table by cutting rows and appending data from
outside (sql from coldfusion or from Excel), user may appends row(s)
in this table. Until compacting everything is fine with those new
records. After compacting, the table opens great but any process using
this table makes db crashing (Access Not Responding). Does anyone can
help on the cause? Thanks.
Is there some field that has invalid data in your appends? You really
need to find what records are causing your problem

Are you sure you are finding all of the wrong records from above?
Here's a routine that will scan all tables and all fields in your
database. You need to create a table, Table1, with the fields TableName
and RecordCount. If it aborts/bombs out you have the last table
accessed and the last record number of the table it could access
correctly. So if you saw the last table in Table1 is TableABC and the
rec count of 40 and there was 500 records in TableABC, you know record
41 is corrupted/bad in that table.

Sub ScanAllTableFields()
Dim tdf As TableDef
Dim r As Recordset
Dim r1 As Recordset
Dim l As Long
Dim i As Integer
Dim v As Variant

Set r1 = CurrentDb.OpenRecordset("Table1", dbOpenDynaset)

For Each tdf In CurrentDb.TableDefs
If Left(tdf.name, 4) <"MSys" Then
Set r = CurrentDb.OpenRecordset(tdf.name, dbOpenDynaset)
If r.RecordCount 0 Then
l = 0
r.MoveFirst
Do While Not r.EOF
For i = 0 To r.Fields.Count - 1
v = r(i).Value
Next
l = l + 1
If l <1 Then
r1.Edit
Else
r1.AddNew
End If
r1!TableName = tdf.name
r1!RecordCount = l
r1.Update
r1.Bookmark = r1.LastModified
r.MoveNext
Loop
Else
r1.AddNew
r1!TableName = tdf.name
r1!RecordCount = 0
r1.Update
End If
r.Close
Set r = Nothing
End If
Next tdf
r1.Close
Set r1 = Nothing
MsgBox "Done"
End Sub
Sep 13 '07 #2
On Sep 13, 10:28 am, Wally <ro2st...@gmail.comwrote:
Hi there,
One table is corrupted. I found compacting is the cause or triggers
the process. I have the solution to repair the wrong records but after
each compact the same table is corrupted again at the same place.
After repairing the table by cutting rows and appending data from
outside (sql from coldfusion or from Excel), user may appends row(s)
in this table. Until compacting everything is fine with those new
records. After compacting, the table opens great but any process using
this table makes db crashing (Access Not Responding). Does anyone can
help on the cause? Thanks.
You may have a corrupted database. Try creating a new blank database
and then importing all of the objects from the old one. That may
solve the problem. Don't forget to select options from the Import
Objects dialogue, and select Relationships and Menus.

Sep 13 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Danny McCarthy | last post by:
I have an access database that I am having some serious problems with. In one of the Tables some records appear to contain "#error" and others "#deleted". Also when i then go neaqr a "#error" i...
0
by: krisa | last post by:
Would appreciate any help on this: I have an A2K frontend/backend application developed & tested on client's "usual" server. Then moved both back and front ends to a different server so...
6
by: KEVIN97810 | last post by:
Hello to all, Assume my mdb name is Cust.MDB. I want to compact & repair the same Cust.MDB when the user exit the program. Is there a way you can do it in code behind the EXIT button. I am...
3
by: Paolo | last post by:
Hi, I am trying to compact and repair my database, however every time I try it comes up a message saying: Table: "TempMSysAccessObject already exists", whenever I try to look for this table I...
6
by: GaryDave | last post by:
My school registration database has not been quite right after a recent compact and repair (done while I was away). Though most of the many forms and subforms are working normally, one form in...
9
by: Jeff | last post by:
This a little strange. The link in a FE database get corrupted when the BE get compacted, and the FE is not even open. I have checked. The data is fine in the BE. The data is fine in the link...
3
by: G Gerard | last post by:
Hello The more I use an application ( an mdb) created using MSAccess I notice that the Byte size of the application keeps on increasing. Once in a while I do a Compact and Repair Database...
2
by: Ron | last post by:
Hi All, Using WinXP pro/Access 2000. I have a database that's been used for about 5 months. Transferred lots of data from a dos based program, then the users have been using it for that 5...
4
by: Bob Alston | last post by:
For those of you that have replicated databases, how often to you compact and repair them? Also what mathod do you use if you do this on an automated way? How do you make sure that the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.