Access and Terminal Services (1 Viewer)

DeonO

Novice Programmer
Local time
Today, 13:37
Joined
Sep 15, 2011
Messages
31
Hi all,
I am trying to write files to the "%USERPROFILE%\AppData\Local\Temp" folder.
It works fine as long as the code runs on the local machine. As soon as the application is run from the Terminal Server, the %USERPROFILE% variable is empty and the write action fails. I have read somewhere that this is a limitation in Access, but surely there must be a way of overcoming this?

Any suggestions?

Much appreciated
Deon
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:37
Joined
Feb 19, 2013
Messages
16,636
don't think it is a limitation per se of Access, just the fact you want the localappdata on terminal server

I found this works for me when the code is run from the terminal server

Set wshell = CreateObject("WScript.Shell")
FolderName = wshell.expandenvironmentstrings("%LOCALAPPDATA%") & "\Temp"
Set wshell = Nothing
 

DeonO

Novice Programmer
Local time
Today, 13:37
Joined
Sep 15, 2011
Messages
31
Thanks - this seems to be working.
 

Users who are viewing this thread

Top Bottom