Export to file.dat

T

Tom Ventouris

I am exporting from A2003, directly from a Table.
The code below works fine, but I need to change the resulting text file
extension to .dat.

Changing to filename.dat, in this code, returns an error message, "the
object or database are read only". Any suggestions that do not require
changing the file name and extension after the export?

DoCmd.TransferText acExportDelim, "Exportspecification", "TableName",
"C:\Documents and Settings\User\folder\filename.txt", True, ""
 
K

Ken Snell \(MVP\)

For security reasons, newer versions of ACCESS will not import or export
(via TransferText) text files with nonstandard files extensions -- the only
file extensions that can be used for text files for ACCESS to import them
are ".txt", ".csv", ".tab", and ".asc". To handle a ".dat" file extension,
see these Knowledge Base articles:

ACC2000: Importing or Linking a Text File Fails for a File That Does Not
Have a Valid File Name Extension
http://support.microsoft.com/default.aspx?id=304206

ACC2000: "Can't Update. Database or Object Is Read-only" Error Message When
You Import or Export Files
http://support.microsoft.com/default.aspx?scid=kb;[LN];245407

ACC2000: How to Import a Text File That Has an Extension That Access Does
Not Recognize
http://support.microsoft.com/?id=306144

(The renaming of the file is the preferred method.)
 
T

Tom Ventouris

Thanks for the quick response. I have looked at the suggested KB articles and
it seems that a manual rename after export is the only option until my text
file user has reorganised to accept a different file extension. The aim was
to export and e mail with minimum user intervention.

Ken Snell (MVP) said:
For security reasons, newer versions of ACCESS will not import or export
(via TransferText) text files with nonstandard files extensions -- the only
file extensions that can be used for text files for ACCESS to import them
are ".txt", ".csv", ".tab", and ".asc". To handle a ".dat" file extension,
see these Knowledge Base articles:

ACC2000: Importing or Linking a Text File Fails for a File That Does Not
Have a Valid File Name Extension
http://support.microsoft.com/default.aspx?id=304206

ACC2000: "Can't Update. Database or Object Is Read-only" Error Message When
You Import or Export Files
http://support.microsoft.com/default.aspx?scid=kb;[LN];245407

ACC2000: How to Import a Text File That Has an Extension That Access Does
Not Recognize
http://support.microsoft.com/?id=306144

(The renaming of the file is the preferred method.)

--

Ken Snell
<MS ACCESS MVP>

Tom Ventouris said:
I am exporting from A2003, directly from a Table.
The code below works fine, but I need to change the resulting text file
extension to .dat.

Changing to filename.dat, in this code, returns an error message, "the
object or database are read only". Any suggestions that do not require
changing the file name and extension after the export?

DoCmd.TransferText acExportDelim, "Exportspecification", "TableName",
"C:\Documents and Settings\User\folder\filename.txt", True, ""
 
K

Ken Snell \(MVP\)

You can programmatically change the exported text file's extension after the
text file export is done. See Name statement in VBA help file.

Example:
Name "C:\FolderName\TextFileName.txt" As
"C:\FolderName\TextFileName.dat"
--

Ken Snell
<MS ACCESS MVP>

Tom Ventouris said:
Thanks for the quick response. I have looked at the suggested KB articles
and
it seems that a manual rename after export is the only option until my
text
file user has reorganised to accept a different file extension. The aim
was
to export and e mail with minimum user intervention.

Ken Snell (MVP) said:
For security reasons, newer versions of ACCESS will not import or export
(via TransferText) text files with nonstandard files extensions -- the
only
file extensions that can be used for text files for ACCESS to import them
are ".txt", ".csv", ".tab", and ".asc". To handle a ".dat" file
extension,
see these Knowledge Base articles:

ACC2000: Importing or Linking a Text File Fails for a File That Does Not
Have a Valid File Name Extension
http://support.microsoft.com/default.aspx?id=304206

ACC2000: "Can't Update. Database or Object Is Read-only" Error Message
When
You Import or Export Files
http://support.microsoft.com/default.aspx?scid=kb;[LN];245407

ACC2000: How to Import a Text File That Has an Extension That Access Does
Not Recognize
http://support.microsoft.com/?id=306144

(The renaming of the file is the preferred method.)

--

Ken Snell
<MS ACCESS MVP>

Tom Ventouris said:
I am exporting from A2003, directly from a Table.
The code below works fine, but I need to change the resulting text file
extension to .dat.

Changing to filename.dat, in this code, returns an error message, "the
object or database are read only". Any suggestions that do not require
changing the file name and extension after the export?

DoCmd.TransferText acExportDelim, "Exportspecification", "TableName",
"C:\Documents and Settings\User\folder\filename.txt", True, ""
 
T

Tom Ventouris

Somethings are just too simple....thank you very much.


Ken Snell (MVP) said:
You can programmatically change the exported text file's extension after the
text file export is done. See Name statement in VBA help file.

Example:
Name "C:\FolderName\TextFileName.txt" As
"C:\FolderName\TextFileName.dat"
--

Ken Snell
<MS ACCESS MVP>

Tom Ventouris said:
Thanks for the quick response. I have looked at the suggested KB articles
and
it seems that a manual rename after export is the only option until my
text
file user has reorganised to accept a different file extension. The aim
was
to export and e mail with minimum user intervention.

Ken Snell (MVP) said:
For security reasons, newer versions of ACCESS will not import or export
(via TransferText) text files with nonstandard files extensions -- the
only
file extensions that can be used for text files for ACCESS to import them
are ".txt", ".csv", ".tab", and ".asc". To handle a ".dat" file
extension,
see these Knowledge Base articles:

ACC2000: Importing or Linking a Text File Fails for a File That Does Not
Have a Valid File Name Extension
http://support.microsoft.com/default.aspx?id=304206

ACC2000: "Can't Update. Database or Object Is Read-only" Error Message
When
You Import or Export Files
http://support.microsoft.com/default.aspx?scid=kb;[LN];245407

ACC2000: How to Import a Text File That Has an Extension That Access Does
Not Recognize
http://support.microsoft.com/?id=306144

(The renaming of the file is the preferred method.)

--

Ken Snell
<MS ACCESS MVP>

I am exporting from A2003, directly from a Table.
The code below works fine, but I need to change the resulting text file
extension to .dat.

Changing to filename.dat, in this code, returns an error message, "the
object or database are read only". Any suggestions that do not require
changing the file name and extension after the export?

DoCmd.TransferText acExportDelim, "Exportspecification", "TableName",
"C:\Documents and Settings\User\folder\filename.txt", True, ""
 

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