[R] RODBC inside MS Access Sub

Felipe Carrillo mazatlanmexico at yahoo.com
Wed Apr 29 20:59:38 CEST 2009


HI:
Is it possible to use the RODBC package within MS Access. I have been using from R but was just wondering if it could be used along with R(D)COM. Something like this:

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim myApp As StatConnector
Set myApp = New StatConnector
myApp.GetErrorText
myApp.Init "R"

myApp.EvaluateNoReturn "library(RODBC)"
myApp.EvaluateNoReturn "myDB <- odbcConnectAccess(CurrentDb)"
'query the database and save it as R object 'a'
myApp.EvaluateNoReturn "a <- sqlQuery(CurrentDb, Paste(""select * From Sample""))"
myApp.EvaluateNoReturn "plot(a)"

Thanks in advance

Felipe D. Carrillo  
Supervisory Fishery Biologist  
Department of the Interior  
US Fish & Wildlife Service  
California, USA




More information about the R-help mailing list