Export to the Back End Folder

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.
 
K

Ken Snell [MVP]

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.
 
T

Tom Ventouris

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/
 

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