Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compact and Repair from vba code 1

Status
Not open for further replies.

TommyTea

Programmer
Nov 7, 2002
43
0
0
US
Does anyone have some code handy to compact & repair from vba? I have an app that offers a major import function and I need to be able to offer the non-technical user a Compact & Repair option.
 
try this:

DoCmd.Hourglass True

DBEngine.CompactDatabase myPath & "\" & datName & ".mdb", myPath & "\" & tempDatName & ".mdb", , , ";PWD =" & DBPassword

Kill myPath & "\" & datName & ".mdb"
Name (myPath & "\" & tempDatName & ".mdb") As (myPath & "\" & datName & ".mdb")

DoCmd.Hourglass False
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top