Corruption in access 2003 form


M

MVP - WannaB

I have a form that will not open in normal or design mode and there are 2
Form_~TMPCLP######## objects in my VBA Project window, and there are 2
Objects with the same name in the MsysObjects table of type 32678 which means
they are forms. I expect that if I am able to delete these I might be able
to salvage my form.

However, Nothing I have tried allows me to delete anything from MsysObjects.
OH there is one other issue, Not able to run any code from the data base
with that form in it. I get a message that the module can't be found...
Nothign specific. So I have been working on something that I would run from
a different database file, like this. Can someone correct my mistake or tel
me where I've gone wrong ?
Thank you.

Function DeleteTemps()
Dim db As DAO.Database
Dim Rs As DAO.Recordset
Set db = OpenDatabase("PATH\FILENAME")

Set Rs = db.OpenRecordset("SELECT * FROM MSysObjects WHERE
(((MSysObjects.Name) Like ""~*"") AND ((MSysObjects.Type = -32768)))") ';,
DAO.dbOpenSnapshot)
Rs.MoveLast
Rs.MoveFirst
While Not Rs.EOF
Access.DoCmd.DeleteObject Access.AcObjectType.acForm, Rs.Fields(0).Value
Rs.MoveNext
Wend
Rs.Close
Set Rs = Nothing
Set db = Nothing
End Function
 
Ad

Advertisements

J

Jerry Whittle

Open a new database file. Import everything from your problem database into
it. If something, such as the problem form, won't move over, it's toast. In
that case import the form from a recent backup.
 

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