VBA needed to delete corrupt records from MsysObjects

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...
Nothing 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 tell
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
 
D

Douglas J. Steele

I seem to recall you posted this earlier, and received a recommendation to
import everything into a new database. Did you try that?

Give up trying to delete from MSysObjects: it's definitely not recommended!

Another thing you could try is to make a copy of your database and do a
compact/repair.
 
M

MVP - WannaB

Yes, I did post this under a different subject line because I did not
remember if I entered a subject line, and the searches from IE would not show
anything resembling my question, so I thought it had not been accepted. I
only now began to look at all messages and found both. Thank you, I have
been moving all that I changed into a previously backed-up copy. Also the
“Notify me of replies†did not work.
That’s enough complaining for now.

I don’t really need an answer to this, but I am stumped as to why that form
went corrupt. It’s a pretty simple unbound form that I was in the process of
developing and testing on my local drive. The form will be used to provide
users with a list of reports to select from and then based on the report
selected provide a selection of parameters for them to use if they want.
Thank you
 
A

a a r o n . k e m p f

if your database corrupts data.. stfu and learn a real database

mvp wannabe, there ain't a single Access MVP that's worth more than
$10/hour
 
Joined
Sep 7, 2005
Messages
2
Reaction score
0
Create a new form with the same name.
Save it and replace the existing form
Delete the new form.

I do this fairly regularly t o remove dead objects, but I have never tried it to recover a database. I have other methods I use to accomplish object recovery.

Best of Luck!

Mark S Groves
Absolute Retail, Inc.
 

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