Transfertext Error - Database or object is read only

J

Jay

Thank you inadvance,

Following code gives me an error "Database or object is read only".
Your insights are appreciated.

Dim MyDate
MyDate = Replace(Date, "/", "-")

OutPutFile = "\\....\Report " & MyDate & ".xls"

DoCmd.TransferText acExportDelim, "MySpecification", "MyFile", OutPutFile,
True
 
D

Douglas J. Steele

You're trying to use the TransferText method, but you've got a file
extension of .xls, which is Excel.

Either use the TransferSpreadsheet method, or change the file extension to
one that's appropriate for text (.txt, .csv, .tab or .asc)

Incidentally, your first two lines would be better written as

Dim MyDate As String

MyDate = Format(Date, "yyyy\-mm\-dd")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top