Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Repairing/getting into a seriously corrupted database 1

Status
Not open for further replies.

MatthewP

Programmer
Jan 16, 2001
176
GB
I've got an Access db and I can't get into it at all, or even repair it ("This database cannot be repaired or is not an access database"). I don't know how this happened, other than that it was right after we rebooted the machine with the database on it - is there anything at all that I can do to retrieve data from this?

Thanks,
Matt.
 
Can you open it while holding the shift key down?

Another thing you might want to try is to create a brand new blank database, and then try to import all of the tables, forms, etc.. from the corrupt database into the blank database.
 
Nice idea, but no such luck.

When I open it first, I get asked for the password, which I type in. Then I get 'The database 'C:...etc.mdb' needs to be repaired or isn't a database file. You or another user may have unexpectedly quit Access while a database was open. Do you want access to repair the database'.

I click yes, then get 'Not A Valid Pasword', followed by 'The Database 'C:/..etc.mdb' can't be repaired or isn't a Microsoft Access database file'. Then I get ' Not A Valid Password' again, and that's it.

I know the password is correct, also the .ldb file doesn't disappear when I close the database down either.

Surely there is some way to read this file?

Thanks again,
Matt.
 
Have you tried checking that the disk is not corrupt in some way - i.e. the database is cross-linked with another file?

I understand that the password etc is held in the database header block - so you could try editing a copy of the database with a sector editer. Assuming that you mean the password in question is a database (rather than user) password then the following code will find it for you.

Function AccessPassword(ByVal Filename As String) As String
Dim MaxSize, NextChar, MyChar, secretpos, TempPwd
Dim secret(13)
secret(0) = (&H86)
secret(1) = (&HFB)
secret(2) = (&HEC)
secret(3) = (&H37)
secret(4) = (&H5D)
secret(5) = (&H44)
secret(6) = (&H9C)
secret(7) = (&HFA)
secret(8) = (&HC6)
secret(9) = (&H5E)
secret(10) = (&H28)
secret(11) = (&HE6)
secret(12) = (&H13)
secretpos = 0
Open Filename For Input As #1 ' Open file for input.


For NextChar = 67 To 79 Step 1 'Read In Encrypted Password
Seek #1, NextChar ' Set position.
MyChar = Input(1, #1) ' Read character.
TempPwd = TempPwd & Chr(Asc(MyChar) Xor secret(secretpos)) 'Decrypt using Xor
secretpos = secretpos + 1 'increment pointer
Next NextChar
Close #1 ' Close file.
AccessPassword = TempPwd
MsgBox AccessPassword
End Function

(I took this from an earlier post!)

 
You can try repairing it from the ODBC Datasources administrator.

Go to User DSN - add - select Microsoft Access driver - select repair - browse for the database

This quite often works when you can't get into the db to repair it.

There are two ways to write error-free programs; only the third one works.
 
Matt,

First off, if you are not under extreme time constraints, spend a bunch of time reading the posts in comp.databases.ms-access about corruption. Pay special attention to what Peter Miller has to say. You'll probably be able to find a few situations there that parallel what you're talking about. (Use groups.google.com to search the archives there.)

If you are under extreme time contstraints, or if you cannot find the answer by reading the posts already up on cdma, go to Peter's business's site, and check out what he can do for you. I don't think his services are cheap, but he is very well respected in the business.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
Matthew,

I had a similar problem last week when a user got the "repair" prompt. That user clicked Yes at the prompt, like I told him to, and then went to Task Manager and closed the program down! I couldn't believe it.

Anyway, no matter what I tried, nothing seemed to work so I created a new database (started with a blank and then imported everything from the "bad" database) and it works fine now. Give that a shot and see what happens. Jessica Morgan
Fire Fighter Sales & Service Co.
Pittsburgh, PA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top