View Full Version : Compact & Repair


voskouee
04-18-2007, 04:43 AM
i am using the following code that i found after searching the Forum

Code:
Public Function CompactData()
SendKeys "%(TDC)", False
End Function

Code:
DoCmd.Close acForm, Me.Name, acSaveNo
CompactData

i added it to the exit button. it does close but the size of the database is not getting smaller. its stays the same and its getting bigger and bigger all the time. actually its not a databas that i have its a utilitity with many queries and vba. when i compact and repair from the menu its trims it down to 1.7 mb when i use the code it stays as it is 70 nmd. any ideas why?

Rich
04-18-2007, 04:56 AM
Don't add it to the Exit button

BrettStah
04-18-2007, 04:57 AM
If you're trying to compact when you close, why not just tell Access to always compact when the database closes, rather than using your own code?

voskouee
04-18-2007, 04:59 AM
Actually i did that.. i set the option on compact on close.. i just found out about it..

thanks guys!