Search code examples
rms-accessdbi

Can you run an MS Access event procedure within R using the DBI package?


There is an MS Access database that has a command button which when clicked activates an event procedure. I have tried to call this using dbExecute() but to no avail (I appreciate I was trying to call a macroname and not a event procedure):

macro_name <- "btnCombine"

sql_query <- paste("EXECUTE ", macro_name)

dbExecute(con, sql_query)

FYI - the command button is called btnCombine.

Note: I am not very knowledgeable with VBA. I have taken a snapshot of the start of the btnCombine VBA code.

Any help is much appreciated.

Thanks.

enter image description here


Solution

  • Nope.

    DBI uses ODBC to connect to Access, VBA and user-defined functions are not available over ODBC.

    You can use COM instead, using RDCOMClient. But that's generally a bit harder and requires some VBA knowledge.