Pretty simple question, I know.
相关问题
- NOT DISTINCT query in mySQL
- Flush single app django 1.9
- keeping one connection to DB or opening closing pe
- Mysql-installer showing error : Memoy could not be
- Android Room Fetch data with dynamic table name
相关文章
- Connection pooling vs persist connection mysqli
- COALESCE, IFNULL, or NZ() function that can be use
- CurrentDb.RecordsAffected returns 0. Why?
- Speed up sqlFetch()
- How Do I Seed My Database in the setupBeforeClass
- I set a MySQL column to “NOT NULL” but still I can
- Where in Django can I run startup code that requir
- Google OAuth 2.0 User id datatype for MYSQL
Check out this solution VBA Compact Current Database.
Basically it says this should work
DBEngine.CompactDatabase source, dest
There's also Michael Kaplan's SOON ("Shut One, Open New") add-in. You'd have to chain it, but it's one way to do this.
I can't say I've had much reason to ever want to do this programatically, since I'm programming for end users, and they are never using anything but the front end in the Access user interface, and there's no reason to regularly compact a properly-designed front end.
If you have the database with a front end and a back end. You can use the following code on the main form of your front end main navigation form:
For Access 2013, you could just do
This is the same as typing ALT, F, I, C on your keyboard.
It's probably a different sequence of letters for different versions, but the "%" symbol means "ALT", so keep that in the code. you may just need to change the letters, depending on what letters appear when you press ALT
Letters that appear when pressing ALT in Access 2013
Yes it is simple to do.
Basically it just finds the "Compact and repair" menuitem and clicks it, programatically.