I would like to open a 2007 Access database in R. To do so I am using the following code:
RIFSdatabase <- odbcConnectAccess2007(paste(db.dir, DB.filename, sep='/'))
If ran in 32 bit R (R console or R studio) the following error is returned:
Warning messages: 1: In odbcDriverConnect(con, ...) : [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
2: In odbcDriverConnect(con, ...) : ODBC connection failed
If ran in 64 bit R (R console or Rstudio) the following error is returned:
Warning messages: 1: In odbcDriverConnect(con, ...) : [RODBC] ERROR: state IM003, code 160, message Specified driver could not be loaded due to system error 126: The specified module could not be found. (Microsoft Access Driver (*.mdb, *.accdb), C:\Program Files\Common Files\Microsoft Shared\OFFICE16\ACEODBC.DLL). 2: In odbcDriverConnect(con, ...) : ODBC connection failed
MS Access Database drivers (*.mdb, *accdb) are listed as User DSN but...if I click configure I get the error message:
"The setup routines for the Microsoft Access Driver (*mdb, *accdb) ODBC driver could not be loaded to system error code 126: The specified module could not be found. (C:\Program Files\Common Files\Microsoft Shared\OFFICE16\ACEODBC.DLL)
How can I fix this connection error?
I have not used my ODBC
drivers on this computer for anything else - based on these errors are they perhaps not installed (despite being listed as User DSN)?
I do not care if I run R in 32 or 64 bit.
odbcDataSources()
to see all available ODBC sources. Also, try the generalized connection method and not the 2007 one:odbcDriverConnect('Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\\Path\\To\\Database\\File.accdb')
– Parfait.mdb
? Should readodbcDriverConnect('Driver={Microsoft Access Driver (*.mdb, *.accdb)};..
– Parfait