How to delete procedure

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

Guest

I am new to forms creation, so I am trying different things. In form design,
I create an event procedure, which opens the VB editor. After screwing
around with some things, I decide I want to delete the event procedure I
created. But when I go to the VB editor and click the Form_frmXXXX on the
left side, I can't delete it. Event if I go to the properties of the form
and remove the "Event Procedure" I still can't delete the Form_frmXXXX. How
do I delete an event procedure that I no longer want attached to the form?
Sorry for the "newbie" level question, but I'm confused.
Thanks,
David
 
You can delete a single event procedure by selecting all the text between:
Private Sub ...
and:
End Sub
and deleting that.

Perhaps you are wanting to delete the entire module? If so, open the form's
properties. On the Other tab of the Properties box, set the form's HasModule
property to No. When you close the form, the module will be lost. When you
compact the database, it will be gone completely.

If you delete the form, the form's module will also be deleted.

If you have a database where you deleted the form, but the module is still
there, the database is partially corrupt. Time to get Access to rebuild it
for you.
1. Decompile a copy of the database by entering something like this at the
command prompt while Access is not running. It is all one line, and include
the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

2. Compact the database:
Tools | Database Utilities | Compact

3. Create a new database:
File | New

4. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html

5. Compact again.

6. Import all objects from the problem database:
File | Get External

7. Open a code window.
Choose References from the Tools menu.
Uncheck any references you do not need.
For a list of the ones you typically need in your version of Access, see:
http://allenbrowne.com/ser-38.html

8. Still in the code window, choose Compile from the Debug menu.
Fix any errors, and repeat until it compiles okay.

At this point, you should have a database where the name-autocorrect errors
are gone, the indexes are repaired, inconsistencies between the text- and
compiled-versions of the code are fixed, reference ambiguities are resolved,
and the code syntax is compilable.

If it is still a problem, the next step would be to get Access to rebuild
the database for you. Follow the steps for the first symptom in this
article:
Recovering from Corruption
at:
http://allenbrowne.com/ser-47.html
 
Outstanding, that's exactly what I needed to know. Thank you very much!
I have another question, but I will post it as a new item.
David
 

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