movefile error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

to all,
i have this error when i ran the code:

"Permission denied."

and this is my code:
'-------------------------------
Private Sub cmd_upload_Click()
Dim fso As New FileSystemObject
Dim fldr As Folder

Set fldr = fso.CreateFolder(ditination & workweek)
'With fso

Set fs = Application.FileSearch
'If Me.sourcefolder = 1 Then

With fs

If .Execute(SortBy:=msoSortbyFileName, _
SortOrder:=msoSortOrderAscending) <> "" Then
For i = 1 To .foundfiles.Count
fn = .foundfiles(i)
MsgBox distination & workweek
'fso.CopyFile fn, distination & workweek

fso.MoveFile fn, fldr
Next i
Me.totalfiles = .foundfiles.Count
Else
MsgBox "No Text Files found in specific drive.", vbInformation,
"Resti"
End If
End With

Set fldr = Nothing
Set fso = Nothing


End Sub

i need your help guys.

resti
 
Hard to say for sure.

I pasted your code and tried to run it. It is quite *incomplete.* I gave up
fixing errors after several minutes. There are all kinds of variables that
are not defined and you didn't provide any code that assigns some of them.
If you can't paste in ready to run code, don't expect a complete answer.
Also, you are using several libraries that you didn't mention that you set
references to.

Not being able to run the code, I'll make a wild guess and say that the
message you are getting means pretty much what it says. You don't have the
correct permissions to the folder you are trying to use. Make sure you have
create and update permissions.

Good luck.

Sco

M.L. "Sco" Scofield, Microsoft Access MVP, MCSD, MCP, MSS, A+
Useful Metric Conversion #18 of 19: 8 nickels = 2 paradigms (My personal
favorite)
Miscellaneous Access and VB "stuff" at www.ScoBiz.com
 
i can send you a simple access file if you gave me your e-mail add for you
check.
thanks

resti
 
Resti,

Like most of the people here, I do not accept files from anyone but clients.

It's not that big a deal.

1 - List the references you have set
2 - Post the complete code

We do it all the time in these forums and it works quite well. We do this
for two main reasons.

1 - I might not get to it right away and one of the other fine people here
might notice the problem and step in.
2 - The reason the help here is free is so that the entire community can
benefit from the answer.

Sco

M.L. "Sco" Scofield, Microsoft Access MVP, MCSD, MCP, MSS, A+
Useful Metric Conversion #18 of 19: 8 nickels = 2 paradigms (My personal
favorite)
Miscellaneous Access and VB "stuff" at www.ScoBiz.com
 
Back
Top