Announcement

Collapse
No announcement yet.

Access 2000er Datei in Access 97er Datei konvertieren

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Access 2000er Datei in Access 97er Datei konvertieren

    Hallo!
    Ich muss eine Access 2000 in eine Access 97 - Datei konvertieren. Aber leider kriegt Access das nicht geregelt, was kann ich tun?
    Ist eine Installation von Office 97 unumgänglich?

    Danke im Voraus

  • #2
    Hallo,

    man könnte über die JRO-Objekte versuchen, das MDB-Format über den <b>Jet OLEDB:Engine Type</b>-Wert zu ändern. In Delphi wird die Typbibliothek für <i>Microsoft Jet and Replication Objects 2.x Library</i> importiert und die so von Delphi generierte Datei »JRO_TLB.pas« in das Projekt eingebunden. Über die Methode <b>CompactDatabase</b> des <b>JetEngine</b>-Objekts wird die Datenbank komprimiert, wobei die JetEngine allerdings den "Umweg" über eine andere Datei erwartet:
    <pre>
    <b>unit</b> CompactDatabaseFrm;

    <b>interface</b>

    <b>uses</b>
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, Buttons, StdCtrls, ComCtrls;

    <b>type</b>
    TForm1 = <b>class</b>(TForm)
    Label1: TLabel;
    EditFileName: TEdit;
    SpeedButtonSelectFile: TSpeedButton;
    OpenDialogMDB: TOpenDialog;
    StatusBar1: TStatusBar;
    ButtonCompactDatabase: TButton;
    <b>procedure</b> SpeedButtonSelectFileClick(Sender: TObject);
    <b>procedure</b> ButtonCompactDatabaseClick(Sender: TObject);
    <b>private</b>
    <font color="#003399"><i>{ Private-Deklarationen }</i></font>
    <b>public</b>
    <font color="#003399"><i>{ Public-Deklarationen }</i></font>
    <b>end</b>;

    <b>var</b>
    Form1: TForm1;

    <b>implementation</b>

    <font color="#003399"><i>{$R *.dfm}</i></font>

    <b>uses</b> JRO_TLB;

    <b>procedure</b> TForm1.SpeedButtonSelectFileClick(Sender: TObject);
    <b>begin</b>
    <b>if</b> OpenDialogMDB.Execute <b>then</b>
    EditFileName.Text := OpenDialogMDB.FileName;
    <b>end</b>;

    <b>procedure</b> TForm1.ButtonCompactDatabaseClick(Sender: TObject);
    <b>var</b>
    JE : IJetEngine;
    sSource : <b>String</b>;
    sDestination : <b>String</b>;
    <b>begin</b>
    <b>if</b> EditFileName.Text &lt;&gt; <font color="#9933CC">''</font> <b>then</b>
    ButtonCompactDatabase.Enabled := False
    <b>else</b>
    Abort;
    sSource := Format(<font color="#9933CC">'Data Source=%s;Jet OLEDB:Engine Type=5'</font>,
    [EditFileName.Text]);
    sDestination := Format(<font color="#9933CC">'Data Source=%s;Jet OLEDB:Engine Type=4'</font>,
    [EditFileName.Text + <font color="#9933CC">'.MDB'</font>]);
    <b>try</b>
    <b>try</b>
    JE := CoJetEngine.Create;
    JE.CompactDatabase(sSource, sDestination);
    SysUtils.DeleteFile(EditFileName.Text);
    RenameFile(EditFileName.Text + <font color="#9933CC">'.MDB'</font>, EditFileName.Text);
    MessageDlg(<font color="#9933CC">'Die Datenbank wurde komprimiert.'</font>,
    mtInformation, [mbOk], 0);
    <b>except</b>
    <b>on</b> E: Exception <b>do</b>
    MessageDlg(<font color="#9933CC">'Fehler beim Komprimieren der Datenbank: '</font> +
    E.Message, mtError, [mbOk],0);
    <b>end</b>;
    <b>finally</b>
    JE := <b>nil</b>;
    ButtonCompactDatabase.Enabled := True;
    <b>end</b>;
    <b>end</b>;
    </Pre>
    In der MDAC-Dokumentation aus dem Microsoft Platform SDK ist unter anderem die folgende Tabelle für die Formate zu finden:
    <pre>
    ' Microsoft Jet OLEDB:Engine Type property values
    Global Const JET_ENGINETYPE_UNKNOWN = 0
    Global Const JET_ENGINETYPE_JET10 = 1
    Global Const JET_ENGINETYPE_JET11 = 2
    Global Const JET_ENGINETYPE_JET20 = 3
    Global Const JET_ENGINETYPE_JET3X = 4
    Global Const JET_ENGINETYPE_JET4X = 5
    ...
    </pre&gt

    Comment

    Working...
    X