Database Corruption Error "AOIndex Is Not An Index In This Table"
Aug 11, 2006
I got this "AOIndex is not an index in this table" error with Access 2000 after replicating a database and storing it in the same network folder. I am not able to open my database now, i am afraid 2days work on my forms is lost. I usually have backup, but the last backup i have is 2 days ago i have made alot of changes to 2 FORMS after that :(
Please anybody have suggestions on how to retrive my forms??? I am really concerned about the forms. I have backup for data and for the reports. Please help me?
Using an Access 2003 format database, opening in Access 2007...When I try to open my database I get two errors and it will not open.ID is not an index in this table.ParentId is not an index in this table.
I get the error when it opens with autoexec and when I bypass autoexec. I have a master copy of the database that I tried to link to the first database to import tables but I still get the error.
I am trying to create a one-to-many relationship between these two tables. I want to be able to access the 3 fields on the [Processors] table within reports based on [AllItems]. [AllItems] is a listing of account activity where the [AccountNumber] repeats. I have every field set as the "Primary Key" on [AllItems] as that is the only way to avoid importing duplicate data. I am getting the error: "no unique index found for the referenced field of the primary table"
I have been searching for an answer to this, but no luck. Has anyone ever seen the below error when loading an Access 2003 database?
"[database name] has detected corruption in this file. To try to repair the corruption, first make a backup copy of the file. Then, on the Tools menu, point to Database Utilities, and click Compact and Repair Database. If you are currently trying to repair the corruption then you will need to recreate this file or restore it fom a previous back up."
The database is already compiled and compacted. It's a new Access 2003 program. Only one user is experiencing this problem. She is on XP while the others are on Windows 2000. Everyone is using 2003. I saw other odd error messages on this machine with other databases, but I was able to avoid them by setting the Macro settings to Low. This is a Network environment. Any thoughts?
I inherited this user written multi user (<=10 simultaneous users) Access 2000 database. The front end in Access 2000, the back end is SQL 2000. All the tables are linked to SQL. When the users were running the Access front end on a Novell server there were no problems. We have sinced moved it to a Windows 2000 server and are now getting a Database needs to be repaired message 2 or 3 times a day. I searched the web and the only thing I came up with is that the Opportunistic Locks Setting on the Windows 2000 server needs to be disabled. Naturally our server team is reluctant to change the settings. Has anyone else experienced this problem or have any suggestions? Right now our solution ws to put a copy og the Access frontend on each user's C:, very ugly and difficult to maintain! Thanks so much for your help!
Viewing an email from Code Project, I ran across this article about database corruption and thought it was worth posting here... Be sure and click on the immediate link below to view the latest updates in the discussion area at the bottom of the web page. ---------------------- http://www.codeproject.com/useritems/rdb.asp
Strange behaviors of an access database By Hamed Mosavi.
Introduction
A while ago I encountered a strange behavior in my application which was using an access database (.mdb file). I placed a question in the CodeProject C++ forum, and I did not get any answer. I started searching the web, MSDN, etc... and I found out that it's not all my fault. I found the reason in a knowledge base article. Look at it's description about the possibility of corruption of an access database file:
"There are several things that can happen, both inside and outside of Access, that may leave your database file damaged (corrupted). The symptoms of a corrupted database can range from #Deleted appearing in certain records, to you being unable to open one of the objects in the database, to you being unable to open the database file in Access altogether." (MSDN-Knowledgebase:283849)
Since I got no answer for my question in the forum, I thought there are at least some guys out there who might don't know this , and also since it's easy to corrupt a mdb file, while it's difficult to understand the reason why the application is not Functioning properly, I started writing this article.
The question is what might cause a damaged access mdb file and also how to repair a damaged access file programmatically.
Background
What can cause the mdb file to corrupt The knowledge base says:
"There are three main reasons why an .mdb file may become corrupted, as follows:
* Interrupted write operation * Faulty networking hardware * Opening and saving the .mdb file in another program"(MSDN-Knowledgebase:283849)
There's a detailed description for each one of these in the knowledge base, but some of important reasons are as follows:
* Losing power during database write * Dropping network connection * Abnormal termination of microsoft Jet connection, such as having task manager to shutdown application, power loss, manual shutdown. (notice that:Fatal system errors almost always cause abnormal termination, refer to kb to find out more information) * Forgetting to close ADO or DAO objects that opened. (Objects from classes like:Recordset, QueryDef, TableDef, and Database) * A large number of open and close operations in a loop (more than 40,000 successive open and close operations could cause corruption) * And worst of all, Opening and saving the .mdb file in another program like MS word. It is not recoverable. all your data will be lost.
"There is no way to recover an .mdb file that was opened and then saved in a different program" (MSDN-Knowledgebase:283849)
How to reduce corruption possibility
* Avoid all above * Compact the database often (The class provided with this article)
Things can get worst Q291162: AutoNumber field duplicates previous values after you compact and repair a database: Microsoft also announces that after we compact and repair our database, it is possible to encounter Duplicate Autonumber field, and if it's your database key, then... fortunately this applies just to those who are using Microsoft Jet version 4.0.2927.4 and earlier. "Microsoft has confirmed this to be a problem in Microsoft Jet version 4.0.2927.4 and earlier." (MS KB Q291162). to find out your Jet engine version try to search your system/32 directory for Msjet40.dll (if you are using v.4 and later) then get the properties of the file. This KB can help you find your version and download latest version:Q239114
Another bug exists there and it's "AutoNumber field is not reset after you compact an Access database" I don't describe a solution for this, since there is one already, and it is not really critical, for more information refer to KnowledgeBase Q287756.
if you lost data and have problem recovering data(yet), this can help you a lot: Q247771 and Q306204.
Using the code
In order to use the code, follow the following steps:
1- Copy DBFitter.cpp and DBFitter.h to your project. 2- Check and possibly change first two #import directives in DBFitter.cpp.
3- include DBFitter.h, Create an object from type DBFitter and use it as follows:
CDBFitter fitter; if ( !fitter.CompactAndRepair(szDbPath,m_szDBPass) ) { AfxMessageBox(fitter.GetLastErrString()); }
CompactAndRepair has 3 forms that can be used alternatively. The first one you see above , The other form just gets database file path as input and does not use password
CompactAndRepair(CString szDbPath)
The last one asks for a source, a destination and password, which can be given "" as password to say there is not a password
4- Don't forget to call AfxOleInit(); in the initialization of your application.
"What to Make Sure of Before You Run the Compact and Repair Utility Before you run the Compact and Repair utility on a database, make sure of the following:
* Make sure that you have enough free storage space on your hard disk for both the original and the compacted versions of the Access database. This means that you must have enough free storage space for at least twice the size of your Access database on that drive. If you need to free some space, delete any unneeded files from that drive, or, if possible, move the Access database to a drive that has more free space.
* Make sure that you have both Open/Run and Open Exclusive permissions for the Access database. If you own the database, make sure to set these permissions. If you do not own the database, contact its owner to find out if you can get these permissions.
* Make sure that no user has the Access database open.
* Make sure that the Access database is not located on a read-only network share or has its file attribute set to Read-only. " (Q283849)
Compact and repair in C# Thanks god, there is already an article: http://www.codeproject.com/cs/database/mdbcompact_latebind.asp
--------------------------
If there are any questions or feedback; please direct them to the original authors link at the top of the page so everyone can benefit.
I believe I have discovered a new way of fixing corrupted forms in Access.
After a crash, one of my forms refused to open in either design or form view saying: Form name | is misspelled or refers to a form that doesn't exist
Having searched the internet for this error I found lots of people recommending Repair/Compact or copying and pasting the currupt object into a new database.
Repair and Compact (Access 97) both ran successfully but failed to fix the problem.
When I attempted to copy and paste the broken form either within the database or externally I got
Error 13: Out of Memory
When I attempted to import the form into a new database I got
Automation error
If I attempted to rename the form, I got:
The save operation failed
Resolution: (I don't know which step here was the key to my success) 1) Delete all other database objects (all tables, queries, forms, macros and modules) 2) Create a new form and put any control on it. 3) Attempt to save the form using the same name as the corrupt form 4) Access asks "The name you entered already exists..." (Aha! The first time Access is admitting that the corrupt form exists.) Say no to this prompt. 5) I was now able to rename and open my corrupt form. Everything was fine.
If this post stops just one other DBA having to go through the morning from hell I just went through then it'll all have been worthwhile!
I have a split database. BE located at a server and FE on each users workstation. There are 8 concurrent users at the most. This runs smoothly over the LAN.
Now I'm adding a new feature to the database. I'm using a wheel loader to weigh products on a weight scale. The operator in the wheel loader is going to use a laptop with wireless LAN to connect to the network.
In risk of loosing the connection which in worst case might corrupt the database, I want to make a new database with a BE/FE setup. The BE will be placed on the same server as the current db. The FE in the wheel loader. I can then link from the current db (BE) to the new db (BE).The new db will only require two linked tables from the current db.
If worst case happens, would my current db be more protected against corruption than if I linked directly to the BE on the current db. I know there's no 'right answer' to this one, but I'd really like some opinions on it though.
I created a subforum with an updateable query, and this works. I can view the results of the query, modify them and add new records.
However I shortly realized that once I deleted a record (either by some VBA code, or by SQL) that I could not re-add the same record through the subform.
I've made sure that the record is deleted, so there is no duplication of the key. I've made sure that Index is Duplicates OK, so there is no duplication issues there.
I want the recordnumber displayed on a continuous form. The code below works with the command button, but not afterinsert.
Here's the code: (function GetPosition() is the control source)
Private Sub Command28_Click() numbers End Sub
Private Sub Form_AfterInsert() numbers End Sub
Private Function getPosition() As String If Me.RecordsetClone.RecordCount > counter Then counter = counter + 1 getPosition = "#" & counter Else getPosition = "#new" End If End Function
Private Sub numbers() counter = 0 Me.Requery End Sub
So it should do something like this:
#1 [ctrl 1] #2 [ctrl 1] #3 [ctrl 1] #new [ctrl 1]
But called from after insert only the records on the screen get updated unless I scroll up, so simplified it looks like this:
----------------- top of subform after scrolling up #3 [ctrl 1] ----------------- top of subform before scrolling up #1 [ctrl 1] #2 [ctrl 1] #new [ctrl 1]
Where else can I put it or how can I modify the code to make it work? Aidan
I have a Composite Index to prevent duplicates I get the error message. How can I trap this?
I resolved it with this PHP Code:
'Trap Error. Dim DataErr As Integer Dim Response As Integer Dim Message As String If DataErr = 3022 Then 'Duplicate value entered Response = acDataErrContinue End If
I was using the following code on a field (ItemCode) that was indexed to prevent duplication of records. The intent is that the user will get an error message that a duplicate exists before they enter all the data for the record and get the built in error message that Access 2003 provides when an index violation has occurred.
Code: Private Sub ItemCode_BeforeUpdate(Cancel As Integer) Dim Answer As Variant Answer = DLookup("[ItemCode]", "tblQuestions", "[ItemCode] = '" & Me.ItemCode & "'") If Not IsNull(Answer) Then MsgBox "Item Code already exists" & vbCrLf & "Please enter unique Item Code.", vbCritical + vbOKOnly + vbDefaultButton1, "Duplicate" Cancel = True Me.ItemCode.Undo Else: End If End Sub
Now, the index for this is based on two fields (ItemCode and Question Group). I would like to display the same message before update but don't know how to include the second field in the syntax.
I added a new field to a table, and saved the table. When the table is reopened, the new field is not there! I thought perhaps I forgot to save the field, so I tried adding the field again. When saving, the error said, "cannot save; duplicate field name".
If I go to toolsoptions and click the "show system objects" the field will show up??
Do you think the best course of action is to import all the objects into a new db and try again?
:eek: I have a large table with 1 damn corrupted record, the database can't be repaird, compact, I can't use the copy ,method since the table is over 9000 record sets.
I tried creating a new table and appending the non-corrupted record into it with no success, it is keep locking on me.
Have you guys tried anything else that works for this situation???
I've inherited a rather messy database which and I need to split it in order for us all to be able to enter data at the same time without problems however I get the following message..Index or primary key cannot contain a Null value..It happens at the table that contains the majority of the data (typical) but I cannot understand what could be causing it. I've check Null Primary Key field and removed all of the "required" statuses out of the fields but still no luck.
I tested on a backup database from a couple of days ago and it worked. Only difference is I've added a few bits and bobs since then and 1 field in the table it's stalling on but this field doesn't contain any null values either and I've tried deleting that field in my test database but made no difference.
How do I create a table that can cross index items in another table. Maybe I am not using the right terms here so let me show a small example.
Say I have a tables of words. tblWords numWordID txtWord
Then I have some entries, all more or less synonyms of each others fresh new clean
Now I want to create a cross-index table, related to the table "tblWords" where I can select synonyms from words already in the table "tblWords", so if I for the word "fresh" add "new" and "clean" as synonyms or entries, if I then go and look at the word "new" it will already have the synonyms "fresh" and "clean", likewise the entry "clean" will then have the synonyms "fresh" and "new".
Kind of a many to many relationship junction table but only with one table!
I hope my explanation have not been to confusing, but let me know if you need a clarification.
I am pullling data from a query using an unbound form and a query that that uses linked tables. I can not edit the index of the tables, so is there a way i can create a new index for sorting data in a form?
I am creating a table with a make-table query. The only trouble is that I can't figure out how to designate which field will be the primary key. Is there a way to do this...... other than creating the table, then manually going into desing mode and specifying the primary key there? I want this to be automated.
I have tbl_orders which records orders. I have a linked table called tbl_order_lines which details the items against each order.
In a nutshell, an item can only appear once in an order. However, I do not know how to create a relationship or code the frm_order in order to reflect this in my DB.
I have a live db running on a VPN network (FE/BE both centrally located on a main server , users 'view' their own personal front end through the VPN tunnel) ) and have recently provided a new updateto the FE. Until this time , most users were problem free but one persisted in getting the above error message. Now the new update is in place , they all get it, and this is when no one else is using the db and a single user logs in and tries to use the system. I guess it must be an internal fault ( ie my fault ) but then why does it work for some and not for others?. It also works no problem on my system at home. The user runs Access 2000 and the db was developed in 2003 ( default file format 2000) Any help most appreciated Thanks in advance.
Code:I'm getting this error:Microsoft OLE DB Provider for ODBC Drivers error '80040e14'[Microsoft][ODBC Microsoft Access Driver] Syntax error in CREATE TABLE statement./mljnew/welcomeportal/registration/registration/test.asp, line 7
What am I doing wrong ??? The code here is probably the MySql correct code (Access uses different data types / field names ???) Hope somebody can help me out, because I can't find the correct data types anywhere ! (like use TEXT instead of VARCHAR, that's all I know...)
Here's the actual sql i'm using (displayed by response.write sql): CREATE TABLE roel (id INT(10) PRIMARY KEY AUTO_INCREMENT, email VARCHAR(155), gevalideerd VARCHAR(10) DEFAULT 'nee', inlogCount INT(10) DEFAULT 0, lastLogin DATETIME)
I simply want to link a table from one database to another but am getting an Error -1002 with the error description: "'|' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long."
I have tried just creating a basic table with one field and linking it to another database and still getting the error. It happens when I compact and repair on close.
I have a linked table to a SQL server table called AllAttendanceEvents. the AllAttendanceEvents table has index called "AttEvents". I wrote the following code:
set AllAttendanceEvents=currentdb.openrecordset("AllAttendanceEvents") AllAttendanceEvents.movefirst AllAttendanceEvents.index="AttEvents"
When it executes the read line statement, it generates the following error: Operation is not supported for this type of object
Is there any way to get around of this problem with the linked tables?