determine users profile path for export path in MS Access
Posted on 2009-12-31
I'm exporting reports and queries within MS Access ADP application. I've been using the users 'C' drive as the location of there "My Documtents" folder, but this isn't the case when the user works remotely.
How do I determine the path of their "My Documents" folder so I can export the file there?
Below is some of the code showing where I hard coded the path and an attempt at using
%Userprofile% as a wild card which didn't work. myGetUserName is a function I use to get
the login name of the user.
Help is appreciated.
On Error GoTo viewReport_Error
Dim myReport As String
Dim temp As String
temp = %Userprofile% & myGetUserName & "\My Documents\"
myReport = Me!lbReportName.Column(2)
myFilePath = "C:\Documents and Settings\" & myGetUserName & "\My Documents\"