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: bde, cursor, dao 3, dll, dll32, msaccess, nil, programmatically change, tip 8
Merlin’s Delphi Forge
Leave a comment