473,659 Members | 2,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exporting text files without .txt extension

Following code exports tables as text files:

For Each tdf In db.TableDefs
StrTblName = tdf.Name
Me.txtProgName = StrTblName
Me.txtProgName. Requery
tblAtt = tdf.Attributes
moddate = tdf.LastUpdated
If Left(StrTblName , 3) <> "tbl" And tblAtt = 0 Then
strSQL = "INSERT INTO tmpExport ( Code ) SELECT _
& " & StrTblName & ".[code] FROM " & StrTblName & ";"
DoCmd.RunSQL strSQL

DoCmd.TransferT ext acExportFixed, "ExportTxt" , "tmpExport" , _
& "C:\CODEFil es\" & StrTblName

I want to export the text file with the exact name as the
table, however, I get an error saying
"Cannot update. Database or object is read only".
This is due to Jet 4.0 text ISAM.
I will concede this and make sure all tables are exported as
..txt files by changing the last line to
"C:\CODEFil es\" & StrTblName & ".txt".
Just need to have one line that RENAMES the
exported file, striping out the ".txt" extension.
I think the filesystemobjec t function is used to rename
external files from within Access, but I'm not sure.
Any ideas?

Nov 13 '05 #1
6 6650
"J. Shrimp, Jr." <ju***********@ hotmail.com> wrote:
Following code exports tables as text files:

For Each tdf In db.TableDefs
StrTblName = tdf.Name
Me.txtProgName = StrTblName
Me.txtProgName. Requery
tblAtt = tdf.Attributes
moddate = tdf.LastUpdated
If Left(StrTblName , 3) <> "tbl" And tblAtt = 0 Then
strSQL = "INSERT INTO tmpExport ( Code ) SELECT _
& " & StrTblName & ".[code] FROM " & StrTblName & ";"
DoCmd.RunSQL strSQL

DoCmd.TransferT ext acExportFixed, "ExportTxt" , "tmpExport" , _
& "C:\CODEFil es\" & StrTblName

I want to export the text file with the exact name as the
table, however, I get an error saying
"Cannot update. Database or object is read only".
This is due to Jet 4.0 text ISAM.
I will concede this and make sure all tables are exported as
.txt files by changing the last line to
"C:\CODEFiles\ " & StrTblName & ".txt".
Just need to have one line that RENAMES the
exported file, striping out the ".txt" extension.
I think the filesystemobjec t function is used to rename
external files from within Access, but I'm not sure.
Any ideas?

Seee the Name statement:

Name <oldpathfilenam e> As <newpathfilenam e>

HTH
Matthias Kläy
--
www.kcc.ch
Nov 13 '05 #2
..dat is a generic extension frequently used. Would that suffice? Change the
last line to:
"C:\CODEFil es\" & StrTblName & ".dat"

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com

"J. Shrimp, Jr." <ju***********@ hotmail.com> wrote in message
news:11******** *****@corp.supe rnews.com...
Following code exports tables as text files:

For Each tdf In db.TableDefs
StrTblName = tdf.Name
Me.txtProgName = StrTblName
Me.txtProgName. Requery
tblAtt = tdf.Attributes
moddate = tdf.LastUpdated
If Left(StrTblName , 3) <> "tbl" And tblAtt = 0 Then
strSQL = "INSERT INTO tmpExport ( Code ) SELECT _
& " & StrTblName & ".[code] FROM " & StrTblName & ";"
DoCmd.RunSQL strSQL

DoCmd.TransferT ext acExportFixed, "ExportTxt" , "tmpExport" , _
& "C:\CODEFil es\" & StrTblName

I want to export the text file with the exact name as the
table, however, I get an error saying
"Cannot update. Database or object is read only".
This is due to Jet 4.0 text ISAM.
I will concede this and make sure all tables are exported as
.txt files by changing the last line to
"C:\CODEFil es\" & StrTblName & ".txt".
Just need to have one line that RENAMES the
exported file, striping out the ".txt" extension.
I think the filesystemobjec t function is used to rename
external files from within Access, but I'm not sure.
Any ideas?

Nov 13 '05 #3
Read http://support.microsoft.com/?id=245407

The only extensions allowed by default are txt, csv, tab, asc, htm and html

I believe that was one of the reasons the .dat extension was explicitly
excluded is that the registry files use it.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"PC Datasheet" <no****@nospam. spam> wrote in message
news:Rz******** *********@newsr ead3.news.atl.e arthlink.net...
.dat is a generic extension frequently used. Would that suffice? Change
the
last line to:
"C:\CODEFil es\" & StrTblName & ".dat"

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com

"J. Shrimp, Jr." <ju***********@ hotmail.com> wrote in message
news:11******** *****@corp.supe rnews.com...
Following code exports tables as text files:

For Each tdf In db.TableDefs
StrTblName = tdf.Name
Me.txtProgName = StrTblName
Me.txtProgName. Requery
tblAtt = tdf.Attributes
moddate = tdf.LastUpdated
If Left(StrTblName , 3) <> "tbl" And tblAtt = 0 Then
strSQL = "INSERT INTO tmpExport ( Code ) SELECT _
& " & StrTblName & ".[code] FROM " & StrTblName & ";"
DoCmd.RunSQL strSQL

DoCmd.TransferT ext acExportFixed, "ExportTxt" , "tmpExport" , _
& "C:\CODEFil es\" & StrTblName

I want to export the text file with the exact name as the
table, however, I get an error saying
"Cannot update. Database or object is read only".
This is due to Jet 4.0 text ISAM.
I will concede this and make sure all tables are exported as
.txt files by changing the last line to
"C:\CODEFil es\" & StrTblName & ".txt".
Just need to have one line that RENAMES the
exported file, striping out the ".txt" extension.
I think the filesystemobjec t function is used to rename
external files from within Access, but I'm not sure.
Any ideas?


Nov 13 '05 #4
From my file -----

What Is A DAT File

It is not a predefined format, it generaly mean "data" and can be like a
dot-ini file, or an xml string, but it can also be a simple list of words to
binary data. Basically, it is not a file extension generally associated to
a, one, specific program and each program may use its own interpretation of
such a file. Generally, a program won't look for some dot-dat file, but for
ProgramName.dat file, or something similar.

In Windows (95,98, ?...), files "system.dat " and "user.dat" store the
configuration ettings, etc... basically, registry settings for your Windows,
installed software. You access / odify these settings using RegEdit.exe
(with EXTREME caution).

Otherwise, a lot of 3rd-party software packages use the "dat" extension for
their settings / data file.
Older versions of SQL Server (pre 7.0) use .DAT to identify backup files and
database device files

Also used for video files.


I read in a newsgroup post where someone had an Access database where the
data as stored in a .DAT file. How is this done?
If it's a SQL Server 6.x backup file it was done using the 6.x management
tools. You will need to restore it through Enterprise Manager. If it's a
device file you're out of luck. Otherwise it might be a proprietary backup
file.


"Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
news:6b******** ************@ro gers.com...
Read http://support.microsoft.com/?id=245407

The only extensions allowed by default are txt, csv, tab, asc, htm and html
I believe that was one of the reasons the .dat extension was explicitly
excluded is that the registry files use it.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"PC Datasheet" <no****@nospam. spam> wrote in message
news:Rz******** *********@newsr ead3.news.atl.e arthlink.net...
.dat is a generic extension frequently used. Would that suffice? Change
the
last line to:
"C:\CODEFil es\" & StrTblName & ".dat"

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com

"J. Shrimp, Jr." <ju***********@ hotmail.com> wrote in message
news:11******** *****@corp.supe rnews.com...
Following code exports tables as text files:

For Each tdf In db.TableDefs
StrTblName = tdf.Name
Me.txtProgName = StrTblName
Me.txtProgName. Requery
tblAtt = tdf.Attributes
moddate = tdf.LastUpdated
If Left(StrTblName , 3) <> "tbl" And tblAtt = 0 Then
strSQL = "INSERT INTO tmpExport ( Code ) SELECT _
& " & StrTblName & ".[code] FROM " & StrTblName & ";"
DoCmd.RunSQL strSQL

DoCmd.TransferT ext acExportFixed, "ExportTxt" , "tmpExport" , _
& "C:\CODEFil es\" & StrTblName

I want to export the text file with the exact name as the
table, however, I get an error saying
"Cannot update. Database or object is read only".
This is due to Jet 4.0 text ISAM.
I will concede this and make sure all tables are exported as
.txt files by changing the last line to
"C:\CODEFil es\" & StrTblName & ".txt".
Just need to have one line that RENAMES the
exported file, striping out the ".txt" extension.
I think the filesystemobjec t function is used to rename
external files from within Access, but I'm not sure.
Any ideas?



Nov 13 '05 #5
I fail to see what point you're trying to make.

If the OP attempts to use your suggestion, he will get the same "Cannot
update. Database or object is read only" error.

And with respect to your question about having "an Access database where the
data as stored in a .DAT file. How is this done?", while you can't link to
it through the File | Get External Data | Link Tables dialog, you can link
to any filename using code.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"PC Datasheet" <no****@nospam. spam> wrote in message
news:v5******** ******@newsread 3.news.atl.eart hlink.net...
From my file -----

What Is A DAT File

It is not a predefined format, it generaly mean "data" and can be like a
dot-ini file, or an xml string, but it can also be a simple list of words
to
binary data. Basically, it is not a file extension generally associated to
a, one, specific program and each program may use its own interpretation
of
such a file. Generally, a program won't look for some dot-dat file, but
for
ProgramName.dat file, or something similar.

In Windows (95,98, ?...), files "system.dat " and "user.dat" store the
configuration ettings, etc... basically, registry settings for your
Windows,
installed software. You access / odify these settings using RegEdit.exe
(with EXTREME caution).

Otherwise, a lot of 3rd-party software packages use the "dat" extension
for
their settings / data file.
Older versions of SQL Server (pre 7.0) use .DAT to identify backup files
and
database device files

Also used for video files.


I read in a newsgroup post where someone had an Access database where the
data as stored in a .DAT file. How is this done?
If it's a SQL Server 6.x backup file it was done using the 6.x management
tools. You will need to restore it through Enterprise Manager. If it's a
device file you're out of luck. Otherwise it might be a proprietary backup
file.


"Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
news:6b******** ************@ro gers.com...
Read http://support.microsoft.com/?id=245407

The only extensions allowed by default are txt, csv, tab, asc, htm and

html

I believe that was one of the reasons the .dat extension was explicitly
excluded is that the registry files use it.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"PC Datasheet" <no****@nospam. spam> wrote in message
news:Rz******** *********@newsr ead3.news.atl.e arthlink.net...
> .dat is a generic extension frequently used. Would that suffice? Change
> the
> last line to:
> "C:\CODEFil es\" & StrTblName & ".dat"
>
> --
> PC Datasheet
> Your Resource For Help With Access, Excel And Word Applications
> re******@pcdata sheet.com
> www.pcdatasheet.com
>
>
>
> "J. Shrimp, Jr." <ju***********@ hotmail.com> wrote in message
> news:11******** *****@corp.supe rnews.com...
>> Following code exports tables as text files:
>>
>> For Each tdf In db.TableDefs
>> StrTblName = tdf.Name
>> Me.txtProgName = StrTblName
>> Me.txtProgName. Requery
>> tblAtt = tdf.Attributes
>> moddate = tdf.LastUpdated
>> If Left(StrTblName , 3) <> "tbl" And tblAtt = 0 Then
>> strSQL = "INSERT INTO tmpExport ( Code ) SELECT _
>> & " & StrTblName & ".[code] FROM " & StrTblName & ";"
>> DoCmd.RunSQL strSQL
>>
>> DoCmd.TransferT ext acExportFixed, "ExportTxt" , "tmpExport" , _
>> & "C:\CODEFil es\" & StrTblName
>>
>> I want to export the text file with the exact name as the
>> table, however, I get an error saying
>> "Cannot update. Database or object is read only".
>> This is due to Jet 4.0 text ISAM.
>> I will concede this and make sure all tables are exported as
>> .txt files by changing the last line to
>> "C:\CODEFil es\" & StrTblName & ".txt".
>> Just need to have one line that RENAMES the
>> exported file, striping out the ".txt" extension.
>> I think the filesystemobjec t function is used to rename
>> external files from within Access, but I'm not sure.
>> Any ideas?
>>
>>
>>
>
>



Nov 13 '05 #6
Thanks for all contributors, had a look at the report utilities
program, wrong version of access and there are errors when converting
so it is a non starter unfortunately.

JBN
Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
13339
by: Berislav Lopac | last post by:
I know how to set Apache to send files with any extension to PHP before sending a response. Is there a way to do so for files with no extension whatsoever? I don't want *all* files to be parsed by PHP, but only those without extension (and, of course, with some selected extensions). Berislav -- If the Internet is a Marx Brothers movie, and Web, e-mail, and IRC are Groucho, Chico, and Harpo, then Usenet is Zeppo.
4
4123
by: hoke | last post by:
I want to display plain text files in the browser. The files contain html and javascript and have a .txt extension. This works fine with files with just html. Unfortunately when showing files with javascript, I get an "error on page" warning and the page is not displayed. I suppose that when Internet Explorer discovers a <script> tag he starts to interpret it. This is not what I want. After all Internet Explorer is a browser and not an...
5
5530
by: Jayjay | last post by:
Is it possible to export a report to word and have it include the graphics that are in the report? I'd like to take some of our reports and export them to word so we can email those to the client, but when I export, I lose the logo as well as any graphics (grey line separaters, etc) and only get the text of the reports.
3
2755
by: Nate Hekman | last post by:
I have an aspx page that generates a file on the fly for a person to download. It sends these http headers: Content-Type: text/plain Content-Disposition: attachment; filename="myfile.lic" The file being downloaded is a license file and MUST be stored with that ..lic extension. If I access this aspx page with IE, it prompts me if I want to open or save
2
3170
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to set this up so as to do it reliably and minimize overhead? There are currently no constraints on the destination table. Assume the user or some configuration specifies the database name, server name, and filename+fullpath. The server is SQL...
3
25859
by: gdaniels | last post by:
Hi, I need some help. The routine below runs when a command button is clicked. A prompt appears to enter the directory path to the folder containing delimited text files to be imported into an Access 97 table. The test folder contains 9 files. The problem is that the 1st file is imported 9 times into the table. How do I correct the routine so it loops properly and imports each file? Thanks in advance. Gary Private Sub...
6
8202
by: sara | last post by:
I have what I think is a little strange...I have to get data from our payroll system into a specific format (fixed record length) as a .txt or .prn file only to upload to our 401k custodian. I can get the data into Access (from Payroll) and write a query with all the fields (inserting fields with spaces, as needed), but I can't figure out how to get it to export to a .txt file - without the field name header row. I don't really ...
1
4902
by: Marty Klunk | last post by:
I have an Access97 data base where we are exporting records out to a text file that is then sent to a customer via EDI transmission. The problem I am having is that during the export process access is converting my number fields to scientific notation and they are getting bounced by our customer's EDI program. Example is .0027 is showing in the text file as 2.7E-3. I have tried setting formatting to fixed with 4 decimals, general with 4, no...
5
48989
by: Doogie | last post by:
Can anoyne tell me why this VBScript will create the file to Excel just fine, but the Excel file will not open up? I am saving it as a xlsx file instead of an xls one and I have the new version of Excel on my machine and have opened other Excel files with that extension but this one I get the following error: "Excel cannot open the file 'Test.xlsx' because the file format or file extension is not valid. Verify that the file has not...
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8630
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2759
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.