vbams-access

Access database not closing properly


I have Microsoft Office Professional Plus 2021 on my laptop.
I am the admin and the only person that uses it.
Access has begun acting strangely.
When I exit out of the application, it closes the window but does not completely close Access.
I tracked it down to this code in the form_load of my main form

strPropValue = CurrentDb.Containers("Databases"("UserDefined").Properties(strPropRevision)

I have tried changing the client settings
When I tried
File -> options -> client settings -> Advanced -> Default Open Mode = Exclusive
when I close Access I get the message

Could not use ; file already in use

the Task Manager background process has Microsoft Access
the database won't open - need to end task in task manager

When I tried
File -> options -> client settings -> Advanced -> Default Open Mode = Shared
when I close Access i get the message

You attempted to open database that is already opened by user 'admin' on machine 'LAPTOP-HP', Try again when the database is available.

the .laccdb file is not deleted
the Task Manager background process has Microsoft Access

I have read about application.quit and docmd.quit but it didn't make a difference.

This code has been working and just stopped. Maybe it is because of a recent update but I don't know where I would look.

I moved the .accdb file to a different folder but it made no difference.


Solution

  • In Trust Center, add your Access file location containing the VBA code to trusted locations. I hope this helps.