Form class module for non-existent form - how remove?

K

Kjell Rilbe

Hi,

After copying a form with a class module, something went wrong. I now
have a class module for the new form, but the form no longer exists. I
am unable to remove the in-limbo class module. I want to use that name
for my form, which is not possible as long as that class module is in
the way.

How do I get rid of the in-limbo class module?

I've tried repairing tha DB as well as "msaccess /decompile" but it
hasn't helped.

Anything else?

Thanks,
Kjell
 
J

Jeanette Cunningham

Kjell,
A class module is not part of a form, but a separate module. It sounds like
your 'in-limbo' module is in reality a class module.
Go to the modules tab in the database window. Find the module and rename it
by selecting it and typing in the new name - for example ModA.
Go back to the forms tab and create the form you want.

Jeanette Cunningham
 
K

Kjell Rilbe

Thanks, but that's not it. The VBA editor lists the module under the
form modules folder and its name is like "Form_..." and it is NOT listed
in the Modules folder of the DB window.

The module IS (at least was) part of a form that I copied under a new
name to create new similar form. I think the first symptom that
something went wrong was that when I clicked the ... button next to the
event property name of one of the events, with code allready attached,
Access said something about no guide existing for this operation. Then
the code win opened like everything was ok, but it opened a different
form's code window. Not even the one I copied from, but a TOTALLY
different form. Then, I can't open the code of the copy (the copied
form, not the original). It says there's a network error or some such.
Not able to find the "file".

I can delete the copy (the form) and create a new blank form with the
same name, but when I try to attach code, it starts over again. When I
delete the form, the class module is still listed under the forms folder
in the VBA editor.

This seems to have happened to other people too, because I found a few
forum Q:s on the web. One reply suggested the /decompile switch
(undocumented), but it didn't help.

I've now gone back to a backup and copied the form "manually" instead.
I.e. creating a new form from scratch. A lot more work, but no bugs
roaring ugly faces at me.

Still, I'd like to see how I could repair this when it happens. It's
bound to happen again, because I often copy forms.

Thanks,
Kjell
 
G

George Nicholson

I have encountered the same thing (i think). I treated it as a symptom of
possible database corruption. I created a new, blank database and imported
all objects into it. The offending form module entry did not survive the
trip, presumably because there was no corresponding form.
 
K

Kjell Rilbe

George,

Interesting! Did you do this in some kind of automated manner? Something
smoother than copy+paste for each item?

Thanks,
Kjell
 
A

AccessVandal via AccessMonster.com

What do you mean by copying "a form with a class module"? Do you mean you
copy the form's class module (not the Access Class module) code's into the
VBA editor with copy and paste?

You must use the database window objects(Forms). Copy the form and wizard
will prompt you for a new name. This will also copy the form's class module's
code.
 
K

Kjell Rilbe

That's what I did. But something went wrong and the connection between
the form and the associated class module is somehow broken. In fact, it
seems like the code didn't get copied at all, only a reference to "it"
(where "it" is void, which it shouldn't be).

Kjell
 
A

AccessVandal via AccessMonster.com

That's odd. The only thing that I can come up is your PC hardware issue (your
RAM) or there might be another software running in the background. If there
aren't any of this like virus/trojen, I out of ideas.
 
G

George Nicholson

-Create a new empty database.
-Be sure Tools>Options>AutoCorrect is OFF

-File>GetExternalData>Import.
-Select All: Tables (except those starting with
"Msys")>Queries>Forms>Reports>Macros>Modules, etc. "OK"

-Check & Set References in the VBE, as necessary. Compile
-Reset Tools>Startup, as necessary.
 

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