Access is an example of software giving perfectly confusing error messages...
Much of the trouble is caused by the 32bit/64bit confusion.
The following code, based on yours, works for me, but only after several attempts:
procedure TForm1.Button1Click(Sender: TObject);
begin
if FileExists(FILE_NAME) then begin
ODBCConnection1.Driver:='Microsoft Access Driver (*.mdb, *.accdb)';
ODBCConnection1.Params.Add('DBQ='+ExpandFileName(FILE_NAME));
// ODBCCon.Params.Add( 'Locale Identifier=1031');
// ODBCCon.Params.Add( 'ExtendedAnsiSQL=1');
ODBCConnection1.Params.Add( 'CHARSET=utf8');
ODBCConnection1.Connected:=true;
ODBCConnection1.KeepConnection:=true;
SQLTransaction1.DataBase := ODBCConnection1;
SQLTransaction1.Action:= caCommit;
SQLTransaction1.Active:=true;
SQLQuery1.UsePrimaryKeyAsKey := false;
SQLQuery1.Open;
end;
end;
I created the test database with Access 2016. I think this is a 32-bit application.
At first I compiled my test application with the 64-bit version of Lazarus - it failed to open the .accdb file with a similar error as yours. Then I tried the 32-bit version of Lazarus which worked but crashed when opening the query because I had forgotten the critical line "SQLQuery1.UsePrimaryKeyAsKey := false".
I am not sure if it is generally true that only 32-bit applications can open Access files by ODBC. Maybe I should install some Office-Addon... But anyway, give it a try and play with the bitness of your compiler.