Compact on Close (1 Viewer)

Cedarguy

Access developer wannabe
Local time
Today, 06:24
Joined
May 8, 2012
Messages
39
Hello,

Compact on close is asking for a password all of a sudden
When I enter the password, it doesn't accept it
Opened the DB exclusive and entered password, says its invalid
When I open the DB normally and enter the password, it accepts and opens.

Would appreciate any suggestions on how to get around this.

Many thanks
 

isladogs

MVP / VIP
Local time
Today, 14:24
Joined
Jan 14, 2017
Messages
18,213
Is the VBA project separately protected with a password?
 

Cedarguy

Access developer wannabe
Local time
Today, 06:24
Joined
May 8, 2012
Messages
39
Thanks for responding, isladogs.

No, its all together in one DB; I only use macros not VBA, thus far.

Regards
 

isladogs

MVP / VIP
Local time
Today, 14:24
Joined
Jan 14, 2017
Messages
18,213
I wasn't talking about a split database
It is possible to add 2 different passwords to a database
a) Whole file password encryption which you have
b) Password protect the VBA project

Just check b) by opening the VB Editor then click Tools...Database Properties.
Select the Protection tab and remove any password that exists (if you can).

If its empty (as you suspect), you may have corruption.
One of the most common causes of that is Compact On Close .... so I would remove it anyway.
 

Cedarguy

Access developer wannabe
Local time
Today, 06:24
Joined
May 8, 2012
Messages
39
Thanks again, isladogs.

Passwords are empty, hence corrupted :(

Is there a better way to de-corrupt than creating a new DB and copying everything over?

Regards
 

isladogs

MVP / VIP
Local time
Today, 14:24
Joined
Jan 14, 2017
Messages
18,213
Yes.
Decompiling the database should fix it. See http://www.fmsinc.com/microsoftaccess/performance/decompile.asp

Do the following in order
1. Untick Compact on close
2. Backup
3. Decompile
4. Compile ...& fix any errors that arise
5. Compact

You should also do the following if not already done to help 'future proof' your db
a) Tick Require Variable Declaration in VBE Options. This will add Option explicit to all new code modules from now on (but not to existing ones).
b) Add Option Explicit as the 2nd line of each existing code module
c) Compile again ...& fix any errors that arise

HTH
 

Cedarguy

Access developer wannabe
Local time
Today, 06:24
Joined
May 8, 2012
Messages
39
Many many thanks, HTH.

I get the decompile bit but the VBA related suggestions went over my head.

Perhaps I'll get it later after I finish the book I'm reading on VBA and start transitioning from macros to VBA :)

Oh, how do I credit you for the excellent help I received form you?

Best Regards,
AMB
 

isladogs

MVP / VIP
Local time
Today, 14:24
Joined
Jan 14, 2017
Messages
18,213

Cedarguy

Access developer wannabe
Local time
Today, 06:24
Joined
May 8, 2012
Messages
39
I followed your instructions and after doing a decompile, have the same problem.

Do I now go to the "new DB and copy everything over" solution?

Thanks
 

isladogs

MVP / VIP
Local time
Today, 14:24
Joined
Jan 14, 2017
Messages
18,213
Hmm. I'm surprised it didn't work.
Did you do EACH of the 5 steps in the list?

I don't use macros so I can't say for sure what will be needed if you have macro corruption
You can certainly try importing all objects into a new database & hopefully that will fix the issue....but it might just copy the problem across to the new database.
Make another backup before you do so...just in case.

If it still fails, suggest you post a stripped down copy of your db
 

Cedarguy

Access developer wannabe
Local time
Today, 06:24
Joined
May 8, 2012
Messages
39
Pulled in each group (tables, queries, etc.) one at a time compacting after each

All good

Thanks again :)

AMB
 

Users who are viewing this thread

Top Bottom