Hi.
On testing my DB over night I noticed several #Error ~Name values etc.
I know why this is, the server is restarted over night and performs maintenance, I can't intervene with this.
So can I at a certain time, say 5am compact and repair the DB which will maintain the size and refresh data to all the forms (subforms).
There is quite alot of selection over the web which discusses FE BE etc but I don't need all that. The DB runs via MS Access Runtime 2013 so opted not to look into the versions which use the VBA ribbon commands or Sendkeys.
Is there an easy VBA command which will just simply compact, repair and reopen the DB?
Kind Regards
Compact - Repair
-
- SilverLounger
- Posts: 1728
- Joined: 25 Jan 2010, 08:34
- Location: Stoke on Trent - Staffordshire - England
Compact - Repair
Cheers ...
Dave.
Dave.
-
- Administrator
- Posts: 78647
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Compact - Repair
You cannot use VBA (or a macro) to compact the current database. You'd get the following error message:
An external procedure (for example a scheduled task in Windows) can compact a database, but only if it is closed, not while it is open...
An external procedure (for example a scheduled task in Windows) can compact a database, but only if it is closed, not while it is open...
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- SilverLounger
- Posts: 1728
- Joined: 25 Jan 2010, 08:34
- Location: Stoke on Trent - Staffordshire - England
Re: Compact - Repair
Thanks Hans, I thought there would be a simple solution. However, I will revert to my previous plan, close the DB at a specific time, I can then schedule to restart once I know the server has fully loaded.
Kind Regards
Kind Regards
Cheers ...
Dave.
Dave.