Here is a utility we built. This tool will create a new db will all
objects with the exception of relationships. Create a new dB and add
the code below to a new form. Create two objects"
text box called "txtOld"
command button called "cmdRecover"
Enter the corrupted DB path and file name in the text box
Add the code below to the click event of the button
***********************************
Private Sub cmdRecover_Click()
Dim rst1 As Recordset
Dim intSpecIdMax As Integer
If Nz(Me.txtOld, "") = "" Then
MsgBox "You must enter file name."
Exit Sub
End If
If Len(Dir(Me.txtOld)) <= 0 Then
MsgBox "The file name you entered could not be found! Please
check the file name and try again."
Exit Sub
End If
If Right(CurrentDb.Name, 20) = "RecoveryDatabase.mdb" Then
MsgBox "Please copy this database and rename to desired
completed file name.", vbOKOnly, "Database Recovery Tool"
Exit Sub
End If
DoCmd.TransferDatabase acImport, "Microsoft Access", Me.txtOld,
acTable, "MSysObjects", "CorruptedObjects", False
DoCmd.TransferDatabase acImport, "Microsoft Access", Me.txtOld,
acTable, "MSysIMEXSpecs", "MSysIMEXSpecs", False
DoCmd.TransferDatabase acImport, "Microsoft Access", Me.txtOld,
acTable, "MSysIMEXColumns", "MSysIMEXColumns", False
'Import Queries
Set rst1 = CurrentDb.OpenRecordset("SELECT Type, Name FROM
CorruptedObjects WHERE Type = 5;")
Do Until rst1.EOF
DoCmd.TransferDatabase acImport, "Microsoft Access",
Me.txtOld, acQuery, rst1!Name, rst1!Name, False
rst1.MoveNext
Loop
'Import Tables
Set rst1 = CurrentDb.OpenRecordset("SELECT Type, Name FROM
CorruptedObjects WHERE Type = 1 AND Flags = 0;")
Do Until rst1.EOF
DoCmd.TransferDatabase acImport, "Microsoft Access",
Me.txtOld, acTable, rst1!Name, rst1!Name, False
rst1.MoveNext
Loop
'Import Forms
Set rst1 = CurrentDb.OpenRecordset("SELECT Type, Name FROM
CorruptedObjects WHERE Type = -32768 AND Flags = 0;")
Do Until rst1.EOF
DoCmd.TransferDatabase acImport, "Microsoft Access",
Me.txtOld, acForm, rst1!Name, rst1!Name, False
rst1.MoveNext
Loop
'Import Reports
Set rst1 = CurrentDb.OpenRecordset("SELECT Type, Name FROM
CorruptedObjects WHERE Type = -32764 AND Flags = 0;")
Do Until rst1.EOF
DoCmd.TransferDatabase acImport, "Microsoft Access",
Me.txtOld, acReport, rst1!Name, rst1!Name, False
rst1.MoveNext
Loop
'Import Modules
Set rst1 = CurrentDb.OpenRecordset("SELECT Type, Name FROM
CorruptedObjects WHERE Type = -32761 AND Flags = 0;")
Do Until rst1.EOF
DoCmd.TransferDatabase acImport, "Microsoft Access",
Me.txtOld, acModule, rst1!Name, rst1!Name, False
rst1.MoveNext
Loop
'Import Macros
Set rst1 = CurrentDb.OpenRecordset("SELECT Type, Name FROM
CorruptedObjects WHERE Type = -32766 AND Flags = 0;")
Do Until rst1.EOF
DoCmd.TransferDatabase acImport, "Microsoft Access",
Me.txtOld, acMacro, rst1!Name, rst1!Name, False
rst1.MoveNext
Loop
DoCmd.DeleteObject acTable, "CorruptedObjects"
MsgBox "The database has been recovered.", vbOKOnly
End Sub
***********************************
Written in MS Access '97 SR2 on OS Win XP Pro
Hope this helps.
> I have an Access 97 DB that is split into front end (on several PCs in the
> LAN) and back end (on the server). I need to add new fields to an existing
[quoted text clipped - 7 lines]
>
> What is the problem, and how can I fix it?