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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"permission denied"

Status
Not open for further replies.

ahau

Programmer
Apr 19, 2006
51
AU
Hi,

I don't know why i'm getting error message "Permission denied" when running the following code.

Sub CreateAfile
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\testfile.csv", True)
a.WriteLine("This is a test.")
a.Close
End Sub

what i'd like to do is to write recordset into a csv file.

Could anyone help me how to get around this problem?

Thank you very much in advance
 
What security setup do you have, I can't replicate the problem you're experiencing?

Laters, Z

"42??? We're going to get lynched!
 
Do you have permission to write to C root?
 
Thank you to you all for your reply.

I think i know what caused it. It's a silly of me to not knowing that the text file i was going to write to was actually open, not close. This is why it doesn't allow me to write into it. I didn't think of this as i was focusing on solving the problem quickly.

Thank you guys
 
Glad to hear you got it sorted!

Laters, Z

"42??? We're going to get lynched!
 
You are aware of the
docmd.TransferText acExportDelim, , "YourQueryName", "c:\testfile.csv"

method which produces a csv file?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top