Thread View: comp.databases.ms-access
5 messages
5 total messages
Started by TIMOTHY W. NEWTON
Wed, 09 Jul 1997 00:00
COMPACT COMMAND BUTTON
Author: TIMOTHY W. NEWTON
Date: Wed, 09 Jul 1997 00:00
Date: Wed, 09 Jul 1997 00:00
3 lines
865 bytes
865 bytes
Does anyone know how to create a command button on a form to compact the database without have to leave it and use Accesses toolbar function.
Re: COMPACT COMMAND BUTTON
Author: Ron Myer
Date: Wed, 09 Jul 1997 00:00
Date: Wed, 09 Jul 1997 00:00
14 lines
1151 bytes
1151 bytes
TIMOTHY W. NEWTON wrote: > > Does anyone know how to create a command button on a form to compact the > database without have to leave it and use Accesses toolbar function. You can not compact on open database! You could create a Windows Macro to Compact the database either on opening or closing! hth, Ron Myer
Re: COMPACT COMMAND BUTTON
Author: GWsales
Date: Thu, 10 Jul 1997 00:00
Date: Thu, 10 Jul 1997 00:00
52 lines
2340 bytes
2340 bytes
On Wed, 09 Jul 1997 15:08:27 -0700, Ron Myer <myeron@ix.netcom.com>
wrote:
>TIMOTHY W. NEWTON wrote:
>>
>> Does anyone know how to create a command button on a form to compact the
>> database without have to leave it and use Accesses toolbar function.
>
>
>You can not compact on open database!
>You could create a Windows Macro to Compact the database either on
>opening or closing!
>
Right. From Access you can create a second application with a nice
front end that can do it to your main app. Include a command button
with this code: (assume your main app is DATA.MDB)
' First, run Repair on your app
DBEngine.RepairDatabase "c:\data.mdb"
' get rid of a temp file left behind from last time you ran _
this process
MyFile = Dir("c:\temp.mdb")
If MyFile = "temp.mdb" Then
Kill "c:\temp.mdb"
End If
DBEngine.CompactDatabase "c:\data.mdb", "c:\temp.mdb", ""
' it's always nice to backup your app before it's replaced
MyFile = Dir("c:\data.bak")
If MyFile = "data.bak" Then
Kill "c:\data.BAK"
End If
Name "c:\data.mdb" As "c:\data.BAK"
' this renames the temp, compacted file as your main app
Name "c:\temp.mdb" As "c:\data.mdb"
You might even reorder this somewhat and do the backup first
George Woody
*****************************************
Check out George Woody and the nutty antics
of his All Star Team of the Future at
http://www.execulink.com/~catcon/GeorgeWoody.htm
(c) 1997 George Woody Hobbies 'n Stuff
GWsales@execulink.com
Re: COMPACT COMMAND BUTTON
Author: Martin Pascal-Murray
Date: Tue, 22 Jul 1997 00:00
Date: Tue, 22 Jul 1997 00:00
17 lines
1435 bytes
1435 bytes
Dear Tim, You can't compact a database which is already open. However, you could write a macro in windows which will do this for you OR if you are good at code, you could write code which will close the database, compact it and then reopen it. The trick lies in getting Access to pass the code over to Windows, otherwise once it's let go of the database it will stop running. Good luck! TIMOTHY W. NEWTON <ENFORCER@PACBELL.NET> wrote in article <01bc8c97$4b5d7e60$3475aace@adp547>... > Does anyone know how to create a command button on a form to compact the > database without have to leave it and use Accesses toolbar function. > >
Re: COMPACT COMMAND BUTTON
Author: Pablo Acosta
Date: Thu, 24 Jul 1997 00:00
Date: Thu, 24 Jul 1997 00:00
31 lines
1780 bytes
1780 bytes
On Jul 9 1997 18:38:57 GMT, "TIMOTHY W. NEWTON" <ENFORCER@PACBELL.NET> wrote: >Does anyone know how to create a command button on a form to compact the >database without have to leave it and use Accesses toolbar function. > Hallo everybody. Sorry because my english is not very good, but I think you'll understand me. I do the following: I create a database that contains tables where are kept the data (DATA.MDB), and other database where I create the forms, querys, reports, etc. (APPLICATION.MDB) and I attach the tables of the database 'DATA.MDB' to 'APPLICATION.MDB'. In this way, the only one database that will fatten will be the one which contains the data and, through four code lines, I can compact it from the application database with a command button or when I quit 'application.mdb'. It is an easy way that allow, not only to compact, even backup the datafile in any moment. A friend from Malaga ;-). ******************** Pablo Acosta piacosta@ctv.es Malaga - SPAIN - ********************
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads