Repair a front end DB from another DB

J

jimt

I have a corrupt (errors when opening) a front-end Access-2000 DB (on an XP
Pro OS). The back-end and other DB open OK. The error msg goes something like:
Module 35
Apphelp.dll
Image Base: 0x77b4000 Image Size 0x00000000
Checksum: 0x00029aea Time Stamp: 0x4802a0bf
Version Information
Signature: feef04bd
StrucVer: 00010000
FileVer: (5.1:2600.5512)
ProdVer: (5.1:2600.5512)
FlagMask: 0000003f
Flags: 00000000
OS: 00040004
FileType: 00000002
SubType: 00000000
FileDate: 00000000:00000000

Is there a way to compact/repair the front-end DB from a DB I can open? I
have a back up of the DB but it is corrupt also. The grandfather back up is
several days old and would rather try to repair the existing DB.

Thanks
Jim T.
 
A

Arvin Meyer MVP

Code like this should work for you:

Function CompactIt()

DBEngine.RepairDatabase DatabaseName & ".MDB"
DBEngine.CompactDatabase DatabaseName & ".MDB", DatabaseName & ".NEW"
Kill DatabaseName & ".MDB"
Name DatabaseName & ".NEW" As DatabaseName & ".MDB"

Exit Function

DatabaseName is the full path to the database.
 
J

jimt

Thanks Arvin for the quick reply. I created a new empty DB
(compress_N_repair.mdb) in the same directory (c:\assessment) as the damaged
DB (MO4ST_05_23x). I then created a module "compact_N_repair" and the
function "CompactIt" you provided. I substituted the DB name in the code to
read:
DBEngine.RepairDatabase "c:\assessment\MO4ST_05_23x" & ".MDB"

After compiling I ran the code in the immediate window (?CompactIt) and
received the error message:
"Run-time error '3251' " Operation is not supported for this type of object."
on the above line of the function.

I tried to look up help on DBEngine and RepairDatabase but both gave a
message of
"Selection not associated with any topics, try another selection".

Appreciate any additional help!
Thanks
Jim T.
 
A

Arvin Meyer MVP

Do you have a reference set to DAO?

Here's some code from the Access 97 help files:

Sub RepairDatabaseX()

Dim errLoop As Error

If MsgBox("Repair the Northwind database?", _
vbYesNo) = vbYes Then
On Error GoTo Err_Repair
DBEngine.RepairDatabase "Northwind.mdb"
On Error GoTo 0
MsgBox "End of repair procedure!"
End If

Exit Sub

Err_Repair:

For Each errLoop In DBEngine.Errors
MsgBox "Repair unsuccessful!" & vbCr & _
"Error number: " & errLoop.Number & _
vbCr & errLoop.Description

Next errLoop

End Sub
 
J

jimt

Arvin

Again Thanks! I made an assumption (incorrectly) that the new empty DB would
have the same references as the previously developed DB. Not true. The new DB
did not have a DAO reference. So to do a like-for-like I took an older DB
that has a reference of "Microsoft DAO 3.6 Object Library" (dao360.dll).

I still receive the run-time error message, 3251- Operation is not supported
for this type of object. I then created a function you posted from Access-97
and changed the Northwind DB to another DB in the directory. I got almost the
same error message. The 97 code error message had a line above that the
repair was unsuccessful. Both runs was from the immediated window.

Is there a different DAO reference I need to include? Or is there a
different set-up issue.

Thanks
Jim T.
 
J

jimt

Arvin,

Thanks for all your efforts. I downloaded and ran the utility. The exe
crashed with a send error report to MS. I haven't run a disk scan but it
could be a bad spot on the disk. I don't know how the DB got hosed but it
looks like a recovery is unlikely.

I've restored a back up and am in the process of re-doing the changes I had
made between versions. As usual whenever you say silently to yourself, "I'll
back up as soon as I finish this coding", IT TOO LATE.

It's handy to have the compact utility anyway....thanks again for your help.

Jim T.
 

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

Top