Hi,
I am working on some code that will download a DB to the users desktop and create the directory if it does not already exist.
the below code works great if you have the absolute paths entered but my issue is that I have 20 users that will need to access this function so I need the code to download the files to that specific users Desktop.
Is there a way to map to a user specific desktop? I know that in Windows %user% is the users Windows login ID which is what I need to use.
Here is the code:
Code:Private Sub Form_Open(Cancel As Integer) Dim fso As Object Dim sSourcePath As String Dim sSourceFile As String Dim sBackupPath As String Dim sBackupFile As String Dim db As New Access.Application Dim buf As String Dim strBu As String sSourceFile = "DB.accde" sSourcePath = "This is the path to the server and works fine" sBackupFile = "DB.accde" sBackupPath = "C:\Documents and Settings\%username%\Desktop\Tracker\" buf = "C:\Documents and Settings\%username%\Desktop\" & "\Tracker\" Set fso = CreateObject("Scripting.FileSystemObject") fso.CopyFile sSourcePath & sSourceFile, sBackupPath & sBackupFile, True Set fso = Nothing DoCmd.Close acForm, "frmDataProcessing" End Sub


Need to download files to users desktop
Reply With Quote


