Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Jai Williams   on Jan 20 In MS Office Category.

  
Question Answered By: Rickey Scott   on Jan 20

I copied and pasted the code  into that last email, and it didn't
come through looking right. I'll try this again, however if it still
looks funny in the email, I'm sure you can copy and paste into your
module and break it apart correctly.

Dim dbOriginal As String
Dim dbCompact As String
Dim dbPath As String
Dim dbTempPath As String

dbOriginal = "Inventory and Cost.mdb" 'Original Database
dbCompact = "Inventory and Cost1.mdb" 'Database to copy too
dbPath = "M:\Databases\" & dbOriginal 'Path of original database
dbTempPath = "M:\Databases\" & dbCompact 'Path of new database

Call DBEngine.CompactDatabase(dbPath, dbTempPath) 'Compact data
DoEvents
Kill dbPath 'Delete original
DoEvents
Name dbTempPath As dbPath 'Rename new database  to original name

Share: 

 

This Question has 11 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Compact & Repair Access Database from Excel Or get search suggestion and latest updates.


Tagged: