Your posts remind me of my own experiences with Access. Since I am usually working with the 32-bit IDE I was only able to open mdb files when I used the driver specification without the *.accdb (ODBCConnection1.Driver := 'Microsoft Access Driver (*.mdb)' - there was no way to get mdb files to load without error from 64-bit applications. Finally I noticed that the corresponding driver, the one with '(*.mdb; *.accdb)' as specified in your code, was not installed by default, at least on my Windows. But it is possible to download and install it from
https://www.microsoft.com/en-us/download/details.aspx?id=54920 (Access Database Engine Redistributable). There are downloads for both 32-bit and 64-bit, but you can only install one of them! I installed the 64-bit version since for 32-bit the old driver ('*.mdb') is available by default (at least on my machine).
With the incorrect driver you are alway annoyed by a long barely understandable error message (like in reply #4)!
So, the essence is (after installing the 64-bit Access Database Engine Redistributable):
- for 32-bit applications (i.e. 32-bit Lazarus IDE): use
ODBCConnection1.Driver := 'Microsoft Access Driver (*.mdb);'- for 64-bit applications (i.e. 64-bit Lazarus IDE): use
ODBCConnection1.Driver := 'Microsoft Access Driver (*.mdb; *.accdb);', but only when the 64-bit Access Database Engine Redistributable is installed; if not you cannot use the 64-Lazarus IDE for mdb files.
Regarding your compilation issue: I see in your screenshot of the form in the designer that two components seem to be missing: TSQLTransaction and TSQLQuery. Drop them on the form, and the application should work since all the properties required are set by code in your example.