![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello to all, Assume my mdb name is Cust.MDB. I want to compact & repair the same Cust.MDB when the user exit the program. Is there a way you can do it in code behind the EXIT button. I am dumping data from SQL to temp table and also delete from these tables in Cust.MDB. This would cause the MDB to get big. So I just want some code to compact and repair as user Exit from the access database. thanks a bunch. |
#3
| |||
| |||
|
|
The better thing to do is to just use the Kill command to delete Cust.mdb and then recreate Cust.mdb and its tables. -- PC Datasheet Your Resource For Help With Access, Excel And Word Applications resource (AT) pcdatasheet (DOT) com www.pcdatasheet.com "KEVIN97810" <kevin97810 (AT) aol (DOT) com> wrote in message news:20050102194927.08116.00002894 (AT) mb-m05 (DOT) aol.com... Hello to all, Assume my mdb name is Cust.MDB. I want to compact & repair the same Cust.MDB when the user exit the program. Is there a way you can do it in code behind the EXIT button. I am dumping data from SQL to temp table and also delete from these tables in Cust.MDB. This would cause the MDB to get big. So I just want some code to compact and repair as user Exit from the access database. thanks a bunch. |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Hello to all, Assume my mdb name is Cust.MDB. I want to compact & repair the same Cust.MDB when the user exit the program. Is there a way you can do it in code behind the EXIT button. I am dumping data from SQL to temp table and also delete from these tables in Cust.MDB. This would cause the MDB to get big. So I just want some code to compact and repair as user Exit from the access database. thanks a bunch. |
#6
| |||
| |||
|
|
I use the following function just before quiting the application to test for a file saize and set the autocompact on close to true if the file is greater than a certain size. This means I do not have to compact it everytime it closes but only when a certain size has been exceeded. Call it just before your application.quit statement. Public Function AutoCompactCurrentProject() Dim fs, f, s, filespec Dim strProjectPath As String, strProjectName As String strProjectPath = Application.CurrentProject.Path strProjectName = Application.CurrentProject.Name filespec = strProjectPath & "\" & strProjectName Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFile(filespec) s = CLng(f.Size / 1000000) 'convert size of app from bytes to Mb's If s > 3 Then 'edit the 3 (Mb's) to the max size you want to allow your app to grow. Application.SetOption ("Auto Compact"), 1 'compact app Else Application.SetOption ("Auto Compact"), 0 'no don't compact app End If End Function |
#7
| |||
| |||
|
|
Assume my mdb name is Cust.MDB. I want to compact & repair the same Cust.MDB when the user exit the program. Is there a way you can do it in code behind the EXIT button. I am dumping data from SQL to temp table and also delete from these tables in Cust.MDB. This would cause the MDB to get big. So I just want some code to compact and repair as user Exit from the access database. thanks a bunch. |
![]() |
| Thread Tools | |
| Display Modes | |
| |