To work with MS Access, connect to it using ODBC. Use the same syntax as you would use for Microsoft SQL server.
Actually, it can be a bit tricky. Here's a hint if running into problems:
put "DSNName" into connDSN -- the name of a prefab ODBC connection DSN put "MyDataBase" into connDB -- optional, if used omit the ".mdb" here! put empty into connUser -- or Username, if needed put empty into connPass -- or Password, if needed get RevOpenDatabase("odbc", connDSN, connDB, connUser, ConnPass) if it is not a number then -- throw an error
- The first parameter is "odbc" as expected.
- The second parameter is the name of a pre-made ODBC DSN.
- The third parameter can be left blank, as the database name is in the DSN already. But if it is used (for instance for clarity), the extension must be omitted!
- Even if parameters 3 to 5 are optional, at least empty must be provided.
So the shortest working format is:
get RevOpenDatabase("odbc", "DSNName",,,)
Creating the ODBC conectionEdit
- Goto Control panel -> Administrative Tools -> Data Sources(ODBC). On 64bit don't work you get an eror, launch the 32bit client c:\Windows\SysWOW64>odbcad32.exe.
- Click the ADD button. This will popup a window asking for the correct driver, Select Microsoft Access Driver (*.mdb) and click finish
- Set the name as "runrev" and select the database file.