shell - issue with R script execution from Access 2016 command button -


i’m trying execute r script access 2016 command button. script reads in file , generates plot values inside file. works when run windows 10 command line follows:

c:\program files\r\r-3.3.2\bin>rscript --vanilla h:\r\analyze.r h:\r\lch_22.vcf 

i execute r script button in access 2016.

here vba script i'm using:

dim file_path string  file_path = "h:\r\lch_22.vcf"  dim retval retval = shell("""c:\program files\r\r-3.3.2\bin\rscript.exe"" --vanilla ""h:\r\analyze.r"" ""h:\r\lch_22.vcf""", vbhide)  msgbox retval 

the script executes generates blank plot. has axis , labels data missing. i'm not sure why happening.

follow up i've replaced vbhide vbnormalfocus , able generate plot data... yeah! however, don't understand why substituting variable shell command doesn't work. please explain how accomplish correctly? read file name form in access , part of code has dynamic (see example of attempt below).

dim file_path file_path = "c:\r\dna.vcf" dim retval retval = shell("""c:\program files\r\r-3.3.2\bin\rscript.exe"" --vanilla ""c:\r\analyze.r"" "" & file_path & """, vbnormalfocus) 

thank in advance.

simply add 1 more pair of quotes around file_path:

dim file_path string dim retval integer  file_path = "c:\r\dna.vcf"  retval = shell("""c:\program files\r\r-3.3.2\bin\rscript.exe"" --vanilla "_                & """c:\r\analyze.r"" """ & file_path & """", vbnormalfocus) 

Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -