ник: seluvan
Private Sub Êíîïêà8_Click()
On Error Resume Next
Dim r As DAO.Recordset
Dim st As String
Dim sFileName As String, sNewFileName As String
Dim objFSO As Object, objFile As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
st = "SELECT " & _
"FROM " & _
"WHERE дата >= #" & Format([Forms]![ÏîäãîòîâêàÎò÷åòà]![ÏîëåÑîÑïèñêîì2], "mm\/dd\/yyyy") & "# And ÐåãèñòðÏåðå÷íÿÀÎ.ÄàòàÄîêóìåíòà <= #" & Format([Forms]![ÏîäãîòîâêàÎò÷åòà]![ÏîëåÑîÑïèñêîì4], "mm\/dd\/yyyy") & "#"
Set r = CurrentDb.OpenRecordset(st)
sNewFileName = "c:\" & "Папка c " & [Forms]![ÏîäãîòîâêàÎò÷åòà]![ÏîëåÑîÑïèñêîì2] & " ïî " & [Forms]![ÏîäãîòîâêàÎò÷åòà]![ÏîëåÑîÑïèñêîì4] & " ( " & Format(Time, "hh.mm.ss")
If r.RecordCount > 0 Then
MkDir (sNewFileName)
Else
End If
With r
If Me.флаг1= -1 Then
Do While Not .EOF
Set objFile = objFSO.GetFile(r!ПутьКОригиналу)
objFile.copy sNewFileName
.MoveNext
Loop
MsgBox "скопировано- " & r.RecordCount & "записей", vbInformation, "удача"
End If
End With
PrintDoc 1
End Sub
вроде как путь на папку правильный, но не копирует