Undelete a form with VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way to undelete queries and forms with it's associated VBA code?
I accidentally deleted some queries e forms with VBA modules from a very
important Access 97 database.
I haven't compacted the database and I'm most interested on the Forms and
VBA code that took me many many hours to create.
As this is not a corrupted data base can it be recovered?
 
Hi, Jorge.
Is there any way to undelete queries and forms with it's associated VBA code?

If you only deleted only one object via the GUI (selected the object in the
Database Window, then hit the <DEL> key) and haven't done any other operation
or closed the database, then you can hit <CTRL><Z> or select the Edit menu ->
Undo and the object will reappear. If you deleted more than one object via
the GUI or deleted objects via VBA code, then the rest of those objects
cannot be recovered.

You need to restore from the most recent backup of your database. You _did_
back up this very important database, didn't you?

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
Beware to those who use munged addresses: known newsgroup E-mail harvesters
for spammers are (e-mail address removed) and (e-mail address removed)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. Remember that questions
answered the quickest are often from those who have a history of rewarding
the contributors who have taken the time to answer questions correctly.
 
Hi Gunny

Thanks for your answer.
Usually the worries on backingup a database are focused on the data.
My data is perfectly fine because I have it on a separated SQL database
backedup on a daily basis.
My tears dropped because I lost my VBA code associated with the forms and my
earliest backup is from March 2004 and I was making, and made, a few changes
since then.
I was hopping that there would be a way since the size of the file remains
the same and if I look inside (Notepad) I can still find the Forms and the
SQL statements. They are very difficult to read, but they are all there.
Using the Database, TableDefs, QueryDefs and Containers objects in VBA
nothing is visible, not even the "~TMP*" tables and queries.
I was searching for some kind of software that would recover them from
inside the file to a separate DB.

J. Martins
 
Hi, Jorge.
Using the Database, TableDefs, QueryDefs and Containers objects in VBA
nothing is visible, not even the "~TMP*" tables and queries.

Once you delete the object, Jet marks the object for deletion. Only the
last object deleted while using the GUI can be recovered, as long as the
conditions that I outlined before are met. Once Jet marks an object for
deletion, Jet starts doing its housekeeping and overwriting chunks of that
previously written data with new data or with moved data.
I was hopping that there would be a way since the size of the file remains
the same and if I look inside (Notepad) I can still find the Forms and the
SQL statements. They are very difficult to read, but they are all there.

This means that Jet hasn't overwritten all of the data yet, but if you can
identify bits and pieces, such as VBA code, then copy it from Notepad and
paste it into a module as quickly as possible, because those pieces will be
unrecognizable fairly soon. You may be able to do the same with SQL
statements in deleted queries. Don't waste your time with trying to recover
any forms, because Jet saves them in a proprietary format that is just about
impossible to recreate if any of the pieces of data are missing or have been
overwritten.
I was searching for some kind of software that would recover them from
inside the file to a separate DB.

Don't waste your time with that, either. There _is_ no software for this
type of recovery and it's extremely unlikely that there ever will be. It's
pretty much an exercise in futility. Every database file is different, and
there's no way to tell how much of each deleted object's data has already
been overwritten by Jet, nor in which data pages the objects were stored when
deleted, so there's no way for a software application to effectively identify
what to hunt for nor where to hunt.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
Beware to those who use munged addresses: known newsgroup E-mail harvesters
for spammers are (e-mail address removed) and (e-mail address removed)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. Remember that questions
answered the quickest are often from those who have a history of rewarding
the contributors who have taken the time to answer questions correctly.
 

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

Back
Top