Rx_
Nothing In Moderation
- Local time
- Today, 08:04
- Joined
- Oct 22, 2009
- Messages
- 2,803
My MS Access application provides all reports using Excel Automation.
When a user selects a report, the Excel report is saved on a network drive in a folder X:\MyBusiness\MyUserCommunity\Database Reports\UserID\ReportName\<date/time>ReportName<filterlist>.xls
The first step for a new user for the database is to create a folder named with the user id. This subroutine is called from the report form's open event. If it already exist, do nothing - else create it.
The advantages of each user having a folder, then a subfolder named for each report type plus the date time stamp in the report name: It provides an automated filing system for each user.
For Citrix Users - this provides a simplistic way to save reports running on a common server.
When a user selects a report, the Excel report is saved on a network drive in a folder X:\MyBusiness\MyUserCommunity\Database Reports\UserID\ReportName\<date/time>ReportName<filterlist>.xls
The first step for a new user for the database is to create a folder named with the user id. This subroutine is called from the report form's open event. If it already exist, do nothing - else create it.
The advantages of each user having a folder, then a subfolder named for each report type plus the date time stamp in the report name: It provides an automated filing system for each user.
For Citrix Users - this provides a simplistic way to save reports running on a common server.
Code:
Sub FirstTimeUser()
' If a new user is added to the DB - opening the reports form checks to see if the user directory exist
' The rest of the reports will add a sub directory to this one.
' A user might delete their folder, this will check and see that the folder is missing, and create a new one
Dim strNewReportPath As String ' for directory to save
Dim UserLogin As String
Dim UserPath As String
Dim msgString As String
Dim DirName As String
Dim Response As String
10 On Error Resume Next
20 UserLogin = Environ("username")
30 UserPath = "X:\MyBusiness\MyUserCommunity\Database Reports\" & UserLogin
40 strNewReportPath = UserPath
50 DirName = strNewReportPath
60 If Dir(DirName, vbDirectory) = "" Then
70 DirName = UserPath
80 MkDir DirName
90 Err.Clear '
100 Else
110 Exit Sub
120 End If
130 Exit Sub
End Sub