Solved

Copying file Permissions Error using Access 2007 with Non-Admin Account

Posted on 2014-03-21
3
361 Views
Last Modified: 2014-03-21
I am trying to use Access 2007 to take a copy of a user selected file and copy it to a specific location on a public share using the code below.  However, when I run it, I get a Run-time error '70': Permission denied.

I've used this code in both Access v2003 and v2010 without any issue.  I know for a fact that the account I am logged in with on the computer I am using has local admin rights.  I have also tried re-pointing the code to a folder on the local hard drive, but I get the same result.

I need this function to work regardless of whether the end user has local admin rights or not.  Is there a way to correct this?  If not, is there any other code that would work instead that anyone is willing to share?

Dim Db As Database
Dim old_RST As Recordset

Set Db = CurrentDb
Set old_RST = Db.OpenRecordset("tbl_OldValues", dbOpenDynaset)

Dim image1_Src As String
Dim image1_Dst As String
Dim fname1 As String
Dim pfname1 As String
Dim picpath As String
Dim fs

Set fs = CreateObject("Scripting.FileSystemObject")


old_RST.MoveFirst
picpath = old_RST![docPath]
    
image1_Src = Me.Form1 '(This is a text box on the form holding the source location)
image1_Dst = picpath  '(This is the default destination location saved in a settings table)
fs.CopyFile image1_Src, image1_Dst  'This is line that errors!
fname1 = FileNameFromPath(Me.Form1)
pfname1 = picpath & fname1

Open in new window

0
Comment
Question by:jmcclosk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
omgang earned 500 total points
ID: 39945680
FileSystemObject.CopyFile method will fail if destination location has Read Only attribute set.
http://msdn.microsoft.com/en-us/library/e1wf9e7w(v=vs.84).aspx

Have you checked the destination folder(s) for this?
OM Gang

PS - you can do the exact same thing via VB Script so I don't believe it has anything to do with Access or Access version.
0
 

Author Closing Comment

by:jmcclosk
ID: 39945775
Wow!  Even though I have admin rights on the PC granted by my employer, for some reason all my folders show as read-only... even though I can save/copy files to them!  I made the assumption to trust what they told me and didn't investigate far enough before asking the question.  Sorry!  And, thank you!
0
 
LVL 28

Expert Comment

by:omgang
ID: 39946014
No need to be sorry and you're welcome.
OM Gang
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question