My VBA Code Vanishes - HELP

tthuene

New member
Local time
Today, 06:17
Joined
Feb 22, 2012
Messages
8
I run an Access 2003 Frontend to an SQL-Server backend. The Frontend has about 15,000 lines of source code in various modules and forms. It is stored on a shared drive, and is used by 4 or 5 people.
Every now and then, the code vanishes. I arrive in the morning, open the DB, and no button works. When looking at the code, the code is gone. Empty, Nada, nothing. Anyone has an idea how that happens.
 
I don't know the reason, but I would try a compact and create a new shell. Though based on your post, I'm guessing you probably tried this.
 
Your users are sharing a front end. That should not be done.

Each user should have a separate copy of the FE.
 
Also, if you can open the front-end and expect to see code then it’s not an MDE file.
Might be best to distribute an MDE file.

When you've got nothing you’ve got nothing to lose.
 
This might also have something to do with it.

Microsoft warning message when opening the file…

“The database cannot be opened because the VBA project contained in it cannot be read. The database can be opened only if the VBA project is first deleted. Deleting the VBA project removes all code from modules, forms and reports. You should back up your database before attempting to open the database and delete the VBA project.”

Someone may have got that message but opened the front-end anyway.
 
This might also have something to do with it.

Microsoft warning message when opening the file…

“The database cannot be opened because the VBA project contained in it cannot be read. The database can be opened only if the VBA project is first deleted. Deleting the VBA project removes all code from modules, forms and reports. You should back up your database before attempting to open the database and delete the VBA project.”

Someone may have got that message but opened the front-end anyway.

This is exactly the message thAt usually starts the issue. I just think that is rather post incidence . But what leads to the destruction of the VBA project?

Thanks anywAy. Best TT
 
But what leads to the destruction of the VBA project?

Multiple users in the front end, especially if one of them saves a form or report from design mode.

All uses should have a separate front end.
 
Multiple users in the front end, especially if one of them saves a form or report from design mode.

All uses should have a separate front end.

In the end, this has the highest probability of being the source to your problem. The proper resolution will be to make a separate copy of the Front End for each user to use. Where you put is is not as important as the fact that each copy is used by a single person only.
 
Your users are sharing a front end. That should not be done.

Each user should have a separate copy of the FE.

True enough. i finally came around scripting something that copied the latest version onto the user desktop.
Although this is allowing me a whole lot of other things, unfortunately it has not relieved the problem. But at least I have copy of backup copies to look back to if I need to recreate the DB on the shared drive.

Thanks, Thomas
 
So individual front ends are still losing their code? That is strange. Definitely don't go back to sharing the one FE.

Do you write anything to the front end? I avoid that and can run my FEs as read only if I want though I don't because of the annoying message. It is pretty hard to corrupt a read only mde.
 
Galaxiom,

You can't loose the code in the front end of an MDE when there is none.

Am I correct?
 
Well there actually is still code in the mde. It is just that it is compiled.
 
The original poster is not running an MDE file. From the first post:-
>>The Frontend has about 15,000 lines of source code in various modules and forms.<<

Access can not read some of that source code and so, if we continue to open the database, the VBA source code gets trashed.
Therefore, it is something in the VBA source code which Access does not like.

Why are the users running an MDB file?
Does the original poster know what an MDE file is?
Why has the original poster not acknowledged the difference between an MDB and an MDE file?
Is there code that tries to go into Design mode of a Form, Report or standard Module which prevents the MDB running as an MDE file?


It may be a good time to make a backup, decompile, compile, compact and repair and convert to an MDE file.

Chris.
 

Users who are viewing this thread

Back
Top Bottom