Anyone know how to edit the permissions on the server folder?
Server 2003 standard.
this code runs fine on files on C:\ drive but on the server
\\servername\Share\... it gives error
DougP
Server 2003 standard.
this code runs fine on files on C:\ drive but on the server
\\servername\Share\... it gives error
Code:
' open access database
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim SourceFile, DestinationFile, OriginalPath As String
'Create a new ADO Connection object
Set cn = New ADODB.Connection
With cn
.Provider = "Microsoft.Access.OLEDB.10.0"
.Properties("Data Provider").Value = "Microsoft.Jet.OLEDB.4.0"
.Properties("Data Source").Value = "\\foc01\shareddir\Student Fee Folder\Data from pdf forms.mdb"
.Open
End With
'Create an instance of the ADO Recordset class, and
'set its properties
Set rs = New ADODB.Recordset
'OriginalPath = "c:\Report Cards 11-12\"
OriginalPath = "\\servername\share\Report Cards 11-12\" 'Error when using this path
For b = 1 To 8
With rs
Set .ActiveConnection = cn
.Source = "SELECT [Childs Last Name],[Childs First Name] " _
& "FROM [Data from pdf Latest] " _
& "Where [Entering Grade] = '" & Trim(Str(b)) & "' " _
& "Order by [Childs Last Name],[Childs First Name];"
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.Open
End With
rs.MoveLast
rs.MoveFirst
GradeFolder = Choose(b, "First Grade", "Second Grade", "Third Grade", "Fourth Grade", "Fifth Grade", "Sixth Grade", "Seventh Grade", "Eighth Grade")
SourceFile = OriginalPath & GradeFolder & "\" & Trim(Str(b)) & " Template Report Card 2011-12.xls"
For a = 1 To rs.RecordCount
DestinationFile = OriginalPath & GradeFolder & "\" & rs![Childs Last Name] & ", " & rs![Childs First Name] & " Report Card 2011-12.xls"
FileCopy SourceFile, DestinationFile ' <<< ERROR here
rs.MoveNext
Next
rs.Close
Next
'Set the form's Recordset property to the ADO recordset
Set rs = Nothing
Set cn = Nothing
DougP