Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access denied

Status
Not open for further replies.

Joey4Js

Technical User
Sep 5, 2002
9
0
0
AU
Hi everyone,

I created a database that writes to a text file. This was working fine when I was using it on Windows 98. However, when I changed offices and got an XP computer, I got an error. The following lines:

Set fs = CreateObject("Scripting.FileSystemObject")
Set A = fs.CreateTextFile("c:/textfile.xml", True)

Caused the following error:

Run Time error '70'
Permission denied.

Any ideas on what's happening? Is it because I'm not administrator?

Thanks in advance,

Joe
 
Hi Joe,

Check that you can write to the root of C: on your WinXP setup, as if you didn't have the rights this would cause an access denied error.
This may or may not be due to you not having local administrator priveliges, but you could still have write access to the root of C:. Contact your sysadmin and see if he can change your rights to give you write access to the root of C:, or if he won't let you, get him to logon as admin and try to run it himself.

The other thing is that the path c:/textfile.xml is not valid; the \ character must be used in a DOS/Windows path. Change it to c:\textfile.xml and see if it works properly first.

John
 
As stated above, use the backslash as opposed to the forward slash, though the forward slash tests OK on my XP computer.

The error also occurs if the nominated file already exists and has its attributes set to Read Only (ie. the specific file attributes, even if you have R/W access to the folder).


Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top