How to Programmatically Change the BDE Settings for the MSACCESS Driver and Other BDE

After installing the BDE the default value for the MSACCESS driver is the idda032.dll (DAO 3.0), which is used in Office 95. But if we are using Office 97 we have to change this setting to idda3532.dll (tip 8.1). We can do so using the following code:

...
uses
  BDE;
...
procedure SetOffice97DB;
var
  ConfigDesc: CFGDesc;
  Cursor    : HDBICur;
begin
  DBTables.Session.Active := True;
  try
    Check(DbiOpenCfgInfoList(nil, dbiREADWRITE, cfgPERSISTENT,
      PChar('DRIVERSMSACCESSINIT'), Cursor));
    try
      while DbiGetNextRecord(Cursor, dbiNOLOCK, @ConfigDesc, nil) = 0 do
        with ConfigDesc do begin
          OemToChar(szValue,szValue);
          if (AnsiCompareText(szNodeName, 'DLL32') = 0) and
            (AnsiCompareText(szValue, 'IDDAO32.DLL') = 0) then begin
            StrPCopy(szValue, 'IDDA3532.DLL');
            CharToOem(szValue, szValue);
            Check(DbiModifyRecord(Cursor, @ConfigDesc, True));
            Break;
          end;
        end;
    finally
      DbiCloseCursor(Cursor);
    end;
  finally
    DBTables.Session.Active := True;
  end;
end;

As in the previous tip you have to change the BDBTables.Session property to the name of the component on the form.

Tags: , , , , , , , ,

No Comments Yet

You can be the first to comment!

Leave a comment

OpenID Login

Standard Login