TransferText error message

G

Guest

I am trying to export a table to a fixed width text document with this syntax:

***Start Code***

'Open system form
DoCmd.OpenForm "FormSystem", , , , , acHidden

'Make temporary table
DoCmd.RunSQL "SELECT QueryPIExportUnion.Nominal,
QueryPIExportUnion.YearPeriod, QueryPIExportUnion.Date,
QueryPIExportUnion.Value, QueryPIExportUnion.DorC,
QueryPIExportUnion.JnlType, QueryPIExportUnion.Poster,
QueryPIExportUnion.JnlRef, QueryPIExportUnion.InvNo,
QueryPIExportUnion.Space4, QueryPIExportUnion.Prod,
QueryPIExportUnion.Supplier INTO TableTemp FROM QueryPIExportUnion;"

'Export text. This where the error occurs
DoCmd.TransferText acExportFixed, "ExportToSun", "TableTemp",
Forms![FormSystem]![ExportFile] & Forms![FormSystem]![ExportSequenceNo] &
".ndf"

'Close system form
DoCmd.Close acForm, "FormSystem"

'Delete temporary table
DoCmd.DeleteObject acTable, "TableTemp"

***End Code***

Whenever I do this I get this error message where indicated:
Run-time error '3027':
Cannot update. Database or object is read only.

What am I doing wrong?

Thanks in advance.
 
J

John Nurick

Hi Angus,

Probably the cause is the .ndf file extension. By default, Access will
only accept standard extensions (e.g. .txt, .csv). This
http://support.microsoft.com/?id=304206 shows how to change the
extensions that Access will accept.


I am trying to export a table to a fixed width text document with this syntax:

***Start Code***

'Open system form
DoCmd.OpenForm "FormSystem", , , , , acHidden

'Make temporary table
DoCmd.RunSQL "SELECT QueryPIExportUnion.Nominal,
QueryPIExportUnion.YearPeriod, QueryPIExportUnion.Date,
QueryPIExportUnion.Value, QueryPIExportUnion.DorC,
QueryPIExportUnion.JnlType, QueryPIExportUnion.Poster,
QueryPIExportUnion.JnlRef, QueryPIExportUnion.InvNo,
QueryPIExportUnion.Space4, QueryPIExportUnion.Prod,
QueryPIExportUnion.Supplier INTO TableTemp FROM QueryPIExportUnion;"

'Export text. This where the error occurs
DoCmd.TransferText acExportFixed, "ExportToSun", "TableTemp",
Forms![FormSystem]![ExportFile] & Forms![FormSystem]![ExportSequenceNo] &
".ndf"

'Close system form
DoCmd.Close acForm, "FormSystem"

'Delete temporary table
DoCmd.DeleteObject acTable, "TableTemp"

***End Code***

Whenever I do this I get this error message where indicated:
Run-time error '3027':
Cannot update. Database or object is read only.

What am I doing wrong?

Thanks in advance.
 
Top