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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy and Compact MS Access 2007 database

Status
Not open for further replies.

aperez54

Technical User
Aug 12, 2008
77
CA
I want to create a (new) accdb file that I can put on a scheduler to autoexec the code to copy and compact various accdb files in different servers.

I am stuck at the part of connecting to the database. This is the code I had before:

Public Sub doCompact()
Dim JRO As JRO.JetEngine
Set JRO = New JRO.JetEngine

JRO.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strDestFile & " ; Jet OLEDB:System Database=Q:\PerceptaTools\PerceptaTools.MDW ;User id=annie;Password =irock; ", _
" Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strSourceFile & "; Jet OLEDB:Engine Type=5 "

Set JRO = Nothing

End Sub

---------------------------------------------
sorry i'm a newbie I don't know how to put my code in that box thingy I see everyone else uses when putting code on their posts.

Can anyone help?

Thanks
 
Yes mate,

You type:

[.code.]
Your code here
[./code.]

But you don't use the dots ;)

Sorry, can't help with your real prob as I'm not a fan of 2007. I would suggest it's to do with "Provider=Microsoft.Jet.OLEDB.4.0" though...

JB
 
Thanks JB!

We are all converted to 2007. I don't like it much either. As a matter of fact it took me 2 months just to 'get' the whole ribbon thing.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top