tutorials.de Buch-Aktion 05/2012
ERLEDIGT
JA
ANTWORTEN
1
ZUGRIFFE
1372
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    JaD JaD ist offline Mitglied Bronze
    Registriert seit
    Nov 2007
    Ort
    Bielefeld
    Beiträge
    39
    Hallo ihr LIeben,

    ich habe ein VB-Script, mit dem ich eine Acces-Datenbank komprimiere.
    Eigentlich funktionier das auch prima.
    Hier mal das Script:

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    
      Dim objScript
        Dim objAccess
        Dim strPathToMDB
        Dim strMsg
     
        ' Get the parameter
        Set objShell = WScript.CreateObject("WScript.Shell")
        
        Set arg = WScript.arguments
        
        ' Set the complete path
        strPathToMDB = arg(0) 
     
        ' Set a name and path for a temporary mdb file
         strTempDB = "C:\Comp0001.mdb"                          
     
        ' Creat an object 
         Set objAccess = CreateObject("Access.Application")
     
        ' Repairs and compacts the Database into the temporary mdb file
        objAccess.DbEngine.CompactDatabase strPathToMDB, strTempDB
     
        If Err.Number > 0 Then
            ' There was an error.  Inform the user and halt execution
            strMsg = "The following error was encountered while compacting database:"
            strMsg = strMsg & vbCrLf & vbCrLf & Err.Description
        Else
            ' Create File System Object to handle file manipulations
            Set objScript= CreateObject("Scripting.FileSystemObject")
        
            ' Copy the compacted mdb by into the original file name
            objScript.CopyFile strTempDB, strPathToMDB, True
     
            ' Killing the tempfile
            objScript.DeleteFile strTempDB
        End If
     
        Set objAccess = Nothing
        Set objScript = Nothing

    Mein Problem ist jetzt, das ich damit auch Datenbanken auf Rechnern komprimieren möchte, auf denen Access nicht installiert ist.
    Gibt es da Möglichkeiten?
    Habe selber leider kaum VB-Script Erfahrungen, hoffe jemand kann mir helfen.

    Liebe Grüße
    JaD
     

  2. #2
    JaD JaD ist offline Mitglied Bronze
    Registriert seit
    Nov 2007
    Ort
    Bielefeld
    Beiträge
    39
    Ok, hat sich erledigt.
     

Ähnliche Themen

  1. Access Datenbank aus C++ Programm komprimieren
    Von Beginnerin im Forum C/C++
    Antworten: 2
    Letzter Beitrag: 17.10.05, 13:47
  2. Access Datenbank bei beenden automatisch komprimieren
    Von Thomas Darimont im Forum Office-Anwendungen
    Antworten: 0
    Letzter Beitrag: 30.08.04, 22:51
  3. Ms Access Datenbank von Konsole komprimieren
    Von Thomas Darimont im Forum Office-Anwendungen
    Antworten: 0
    Letzter Beitrag: 17.08.04, 10:44
  4. Access-DB komprimieren
    Von hans_schmid im Forum Relationale Datenbanksysteme
    Antworten: 3
    Letzter Beitrag: 06.05.04, 10:32
  5. Access Datenbank komprimieren und reparieren
    Von LordDeath im Forum .NET Archiv
    Antworten: 2
    Letzter Beitrag: 29.03.04, 12:24