I am trying to merge data from several tables in several MS Access databases. All the tables have the same structure. I found this script online and, visually, it seems to do exactly what I want it to do.
Parent.Folder <- "D:/Documents/Rwd"
subfolders <- list.dirs(Parent.Folder, recursive = TRUE)[-1]
list_filenames <- list.files(subfolders, full.names = TRUE, recursive = FALSE)
acc_files <- list_filenames[grep(".mdb|.accdb", list_filenames)]
output <- lapply(acc_files,
function(file) {
channel <- odbcConnectAccess(file)
# ALTERNATIVE CONNECTION
# channel <- odbcDriverConnect(paste0('driver=
# {Microsoft Access Driver (*.mdb, *.accdb)};
# DBQ=', file))
data <- sqlQuery(channel, "select * from HRESULTS")
close(channel)
return(data)
})
data <- do.call(rbind, output)
The thing is, it gives me an error.
Error in odbcConnectAccess(file) :
odbcConnectAccess is only usable with 32-bit Windows
I started R in 32-bit mode and it throws the error described above.
Any idea what could be wrong? I googled it, and didn't find anything useful.