I do expect it's a corruption.
Basic steps to rebuild are:
1. Verify that Name AutoCorrect is off in the old database. Decompile.
Compact.
2. Create a new (blank) database, and immediately turn off Name AutoCorrect
boxes under:
Tools | Options | General.
Set the minimal references you actually use. This might be a low as 3.
Details:
http://members.iinet.net.au/~allenbrowne/ser-38.html
3. Import all the tables and queries:
File | Get External | Import
using the Advanced button in the import wizard to grab any import specs of
custom toolbars as well.
4. Close the new file, and make a backup. As soon as things go wrong, you
will want to pick up from this point again.
5. If it's one particular form/module that gives you the problem, try
importing all the others, and test that it all works as expected. Use
SaveAsText to export that bad form from the old database into a text file,
and LoadFromText to import it into the new database. If that works, you're
done.
6. If #5 does not work, start again with the file created at step 4, and
programmatically export the forms, modules, and reports to text, and load
them back.
The code below illustrates how you can programmatically export all the
objects of one type (e.g. all forms) to text, and then import them:
----------------starts ends------------------------
Function ExportObjects(lngObjectType As Long) As Long
'Purpose: Create text files of all of the objects of a specified type.
'Argument: Number between 2 and 8 (see array below).
'Return: Number of objects exported.
Dim db As DAO.Database
Dim dox As DAO.Documents
Dim doc As DAO.Document
Dim strFile As String
Dim lngKt As Long
Const conPath = "C:\MyFolder\"
Dim SysObs(8, 2) As String
'These are the names and indexes of the containers, with a file
extension of my choice.
'SysObs(0, 0) = "DataAccessPages"
'SysObs(0, 1) = "dap"
'SysObs(1, 0) = "Databases"
'SysObs(1, 1) = "db"
SysObs(2, 0) = "Forms"
SysObs(2, 1) = "frm"
SysObs(2, 2) = acForm
SysObs(3, 0) = "Modules"
SysObs(3, 1) = "mod"
SysObs(3, 2) = acModule
'SysObs(4, 0) = "Relationships"
'SysObs(4, 1) = "rel"
SysObs(5, 0) = "Reports"
SysObs(5, 1) = "rpt"
SysObs(5, 2) = acReport
SysObs(6, 0) = "Scripts"
SysObs(6, 1) = "scr"
SysObs(6, 2) = acMacro
'SysObs(7, 0) = "SysRel"
'SysObs(7, 1) = "srl"
'SysObs(8, 0) = "Tables"
'SysObs(8, 1) = "tbl"
'SysObs(8, 2) = acTable
Set db = DBEngine(0)(0)
Set dox = db.Containers(lngObjectType).Documents
If MsgBox("Exporting " & dox.Count & " " & SysObs(lngObjectType, 0) &
"?", vbOKCancel, "Confirm export") = vbOK Then
For Each doc In dox
strFile = conPath & doc.Name & "." & SysObs(lngObjectType, 1)
SaveAsText CLng(SysObs(lngObjectType, 2)), doc.Name, strFile
lngKt = lngKt + 1&
Next
End If
ExportObjects = lngKt
Set doc = Nothing
Set dox = Nothing
Set db = Nothing
End Function
Function ImportObjects(lngObjectType As Long) As Long
'Purpose: Create text files of all of the objects of a specified type.
'Argument: Number between 2 and 8 (see array below).
'Return: Number of objects importeded.
Dim strFile As String
Dim strPattern2Match As String
Dim strObjectName As String
Dim lngPos As Long
Dim lngKt As Long
Const conPath = "C:\MyFolder\"
Dim SysObs(8, 2) As String
'These are the names and indexes of the containers, with a file
extension of my choice.
'SysObs(0, 0) = "DataAccessPages"
'SysObs(0, 1) = "dap"
'SysObs(1, 0) = "Databases"
'SysObs(1, 1) = "db"
SysObs(2, 0) = "Forms"
SysObs(2, 1) = "frm"
SysObs(2, 2) = acForm
SysObs(3, 0) = "Modules"
SysObs(3, 1) = "mod"
SysObs(3, 2) = acModule
'SysObs(4, 0) = "Relationships"
'SysObs(4, 1) = "rel"
SysObs(5, 0) = "Reports"
SysObs(5, 1) = "rpt"
SysObs(5, 2) = acReport
SysObs(6, 0) = "Scripts"
SysObs(6, 1) = "scr"
SysObs(6, 2) = acMacro
'SysObs(7, 0) = "SysRel"
'SysObs(7, 1) = "srl"
'SysObs(8, 0) = "Tables"
'SysObs(8, 1) = "tbl"
'SysObs(8, 2) = acTable
strPattern2Match = conPath & "*." & SysObs(lngObjectType, 1)
strFile = Dir$(strPattern2Match)
Do While Len(strFile) > 0&
lngPos = InStrRev(strFile, "\")
strObjectName = Mid$(strFile, lngPos + 1)
lngPos = InStrRev(strObjectName, ".")
If lngPos > 0& Then
strObjectName = Left$(strObjectName, lngPos - 1)
End If
'Debug.Print SysObs(lngObjectType, 2), strObjectName, conPath &
strFile
LoadFromText SysObs(lngObjectType, 2), strObjectName, conPath &
strFile
strFile = Dir$
lngKt = lngKt + 1&
Loop
ImportObjects = lngKt
End Function
----------------code ends------------------------