Hasmodule (1 Viewer)

jd_boss_hogg

Registered User.
Local time
Today, 08:44
Joined
Aug 5, 2009
Messages
88
Hi All - Not a newbie, but somebody that dips into access about once a year, and everything i learned was within 1 month about 20 years ago...so please be gentle with me :)

I'm trying to edit simple font sizes on a form . Its a longstanding form/report that we have used for years. When i come to save, i get a warning that the format isn't compatible with the database and that i should either/or delete clear cells or change "hasmodule" to "no". So, when i change the form property "hasmodule" to "no" i then get another warning that any code behind the form will be lost.... how can i see IF there is any code, and what that code is, before i decide to remove it ?

Thanks for any replies...
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:44
Joined
May 7, 2009
Messages
19,243
i can sense sign of database corruption or your form is corrupted.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:44
Joined
Feb 28, 2001
Messages
27,186
how can i see IF there is any code, and what that code is, before i decide to remove it ?

Since corruption is PERHAPS an issue, first use Windows to make a backup copy of your closed database. Copy/paste will do just fine. Put the copy in a separate folder.

Once you have a copy, you can attempt a Compact & Repair operation. On Access 2021, the ribbon icon for that is on Database Tools. In earlier versions, it might be on the File tab. See if that C&R succeeds and allows you to do what you wanted. If it does, great! If not...

Now open the DB (or it might still be open from the C&R) and try to open the form in design mode. You say you were editing font sizing so that should be possible. You didn't say which version of Access you so I have to be imprecise. Open the "property sheet" display, select the "Other" tab, and look near the bottom for "Has Module" which is a yes/no indicator. If it says "No" then you didn't have VBA code. If it says "Yes" then...

Get to "database tools" on the ribbon and click the Visual Basic icon, more to the left on the ribbon but again, position depends on which version you have. If a VBA code page comes up, look in the title bar of that window to see if it comes from that form. On the left there is (or should be) a navigation pane (or you can click View >> Project Explorer) that includes a so-called tree diagram of all the places in your project that contain code. One of the main branches is the "Microsoft Access Class Objects" which, if you click on the + to expand the branches, will list the forms that have code. You can check for your form name there, too. Clicking on your form's name from the Project Explorer should bring up the code from your form's class module. Note that depending on database settings, you MIGHT need to double-click the form name in Project Explorer. Click sensitivity is an option so could be set for double-click requirements.

In all cases and for any attempts, as long as you don't mess around inside your backup copy, you can get back to where you were before starting any attempts to recover from this error.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 02:44
Joined
May 21, 2018
Messages
8,529
Database corruption at the form level is almost never fixed by a compact and repair. C&R works at the table level. Form level corruption is normally fixed by a compile and decompile. However, you should do both as well as import everything into a new db.

0. Save the most current copy as backup
1. Decompile and Recompile (click link below)
https://www.fmsinc.com/MicrosoftAccess/Performance/Decompile.asp
2. Compact and repair
3. Create a brand new database and import all the tables
4. Compact and repair again
5. Import all the remaining objects (forms, reports, modules)
6. Add references back into new database if necessary
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:44
Joined
Feb 28, 2001
Messages
27,186
Database corruption at the form level is almost never fixed by a compact and repair

Since C&R essentially copies every element of the DB, it will touch the forms. But I agree that true corruption of a form isn't often fixed by C&R. On the other hand, if there IS corruption, C&R might still DETECT it when it tries and fails to copy the elements of the form. I also agree that a DECOMPILE / COMPILE sequence is a valuable part of recovery attempts.
 

isladogs

MVP / VIP
Local time
Today, 07:44
Joined
Jan 14, 2017
Messages
18,221
Just to add to @MajP's summary, decompiling will work in the vast majority of cases and you may not need steps 3-6
However, if you do have to import into a new blank database, make sure you tick all five options to ensure all relationships etc are transferred as well
 

moke123

AWF VIP
Local time
Today, 02:44
Joined
Jan 11, 2013
Messages
3,920
how can i see IF there is any code, and what that code is, before i decide to remove it ?
Press control G to open the VBE. Then look for the form name in the left side panel. Double click the form name to show the code.
 

Users who are viewing this thread

Top Bottom