Export to the Back End Folder

  • Thread starter Thread starter Tom Ventouris
  • Start date Start date
T

Tom Ventouris

I have created the Folder "ExportData" in the folder wher the BE is held.
I am trying to export data from a query to "Exportfile.csv"

Setting the Path and File Name:
Dim Exportfilepath As String
Exportfilepath = Left(Mid(CurrentDb.TableDefs("tblLinkedTable").Connect,
11), Len(Mid(CurrentDb.TableDefs("tblLinkedTable").Connect, 11)) -
Len(Dir(Mid(CurrentDb.TableDefs("tblLinkedTable").Connect, 11)))) & "\" &
"ExportData" & "\" & "Exportfile.csv"

Exporting the Data:
DoCmd.TransferText acExportDelim, "ExportSpecification", "qryDataExport",
"exportfilepath",False, ""

I get Run-time error 3027 "Cannot Update - Database or object is read only."

1. The DB or object are not read only.
2. There is no file named Exportfile.csv in the destination folder.
3. There is no help available for run-time error 3027.

I have gone through the code above and cannot find any errors. Any assistance?
Thanks in advance.
 
Change this line:

DoCmd.TransferText acExportDelim, "ExportSpecification", "qryDataExport",
"exportfilepath",False, ""


to this:

DoCmd.TransferText acExportDelim, "ExportSpecification", "qryDataExport",
exportfilepath,False, ""


You want to use the value from the variable Exportfilepath, not the name of
the variable.
 
Thank you. All done.

Ken Snell said:
Change this line:

DoCmd.TransferText acExportDelim, "ExportSpecification", "qryDataExport",
"exportfilepath",False, ""


to this:

DoCmd.TransferText acExportDelim, "ExportSpecification", "qryDataExport",
exportfilepath,False, ""


You want to use the value from the variable Exportfilepath, not the name of
the variable.

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/
 
Back
Top