| View previous topic :: View next topic |
| Author |
Message |
Avis Junior Poster

Joined: 07 Oct 2003 Posts: 510 Location: India
|
|
| Back to top |
|
pradeep Newbie
Joined: 08 Oct 2003 Posts: 14 Location: INDIA
|
Posted: Oct 18th, 2003 11:59 AM Post subject: |
|
|
| Code: |
'DAO
DBEngine.CompactDatabase olddb, newdb [,locale [,options[,password]]]
'JRO
JetEngine.CompactDatabase(SourceConnection, DestConnection)
|
|
|
| Back to top |
|
Avis Junior Poster

Joined: 07 Oct 2003 Posts: 510 Location: India
|
|
| Back to top |
|
pradeep Newbie
Joined: 08 Oct 2003 Posts: 14 Location: INDIA
|
Posted: Oct 20th, 2003 04:56 AM Post subject: |
|
|
Use JRO, not ADO, to compact a database.
JRO
| Code: |
Sub JROCompactDatabase()
Dim je As New JRO.JetEngine
' Make sure there isn't already a file with the
' name of the compacted database.
If Dir(".\NewNorthWind.mdb") <> "" Then Kill ".\NewNorthWind.mdb"
' Compact the database
je.CompactDatabase "Data Source=.\NorthWind.mdb;", _
"Data Source=.\NewNorthWind.mdb;"
' Delete the original database
Kill ".\NorthWind.mdb"
' Rename the file back to the original name
Name ".\NewNorthWind.mdb" As ".\NorthWind.mdb"
End Sub
|
|
|
| Back to top |
|
rainster Newbie
Joined: 04 Nov 2003 Posts: 4
|
Posted: Nov 4th, 2003 06:29 AM Post subject: |
|
|
Hi everyone!
I was wondering, will this code work without having MS Access actually installed on the computer it is run on?
Example: We use an application that uses a .mdb file for it's configuration, however, MS Access is not installed on that computer. From time to time, the .mdb file becomes corrupt and we have to delete the old .mdb and replace it with a known good/working copy.
Wouldn't it be nice to put a compact and repair program in the windows startup so that maybe the file wouldn't become corrupt?
Thanks in advance for any help with the issue. |
|
| Back to top |
|
ritchieroo Newbie
Joined: 27 Oct 2003 Posts: 8
|
Posted: Nov 4th, 2003 07:16 AM Post subject: |
|
|
The code should not need Access installed to run, and should work fine as long as you have the MDAC components installed.
Check VBA project references on target machines for ADODB, ADOX and JRO etc. |
|
| Back to top |
|
rainster Newbie
Joined: 04 Nov 2003 Posts: 4
|
Posted: Nov 4th, 2003 05:57 PM Post subject: |
|
|
Thanks Ritchieroo, I'll give it a try.
Now all I have to do is figure out if I want to hard code the path (cause its about 5-6 folders deep and hasn't changed in years) or use the apppath thingy and put my experiment in the same directory and drop the shortcut in the startup folder.
I'll post my success/failure later.
Thanks! |
|
| Back to top |
|
|