Transfertext Error - Database or object is read only

  • Thread starter Thread starter Jay
  • Start date Start date
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
 
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")
 
Back
Top