473,386 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to Export a table to fixed width Txt file and different extension

547 512MB
I have been giving this issue a lot of my time and got stuck now. i use Access 2007

I append order data to a table, and then this data must be converted to a delimited text file with an "in" extension and not txt.
name = "order_.in"

From here onwards I use RDM to send the file electronically to the warehouse, after conversion using other software.

My code gives me an error - "cannot update.database or object is read only" ;Runtime 3027

Expand|Select|Wrap|Line Numbers
  1. DoCmd.TransferText acExportDelim, , "rdmexport", "C:\pisprg\order_.in", True, ""
Would it be better to first create a txtfile and then rename the extention to .in?

table name RdmExport
new file name "Order_.in"

I will include an example of another .in file that can be opened with a Notepad to see the format/layout.
i changed the extension to .txt to upload the example.

The Access file with the table in Acc 2003 format is also included.

Info about conversion to text also included

Anybody with ideas to get me out of this nightmare?
Attached Files
File Type: txt ORDER_.in.txt (1.0 KB, 329 views)
File Type: zip RDMexport.zip (10.2 KB, 111 views)
File Type: txt RDM_IMP1.TXT (1.4 KB, 423 views)
Aug 27 '13 #1
6 3904
neelsfer
547 512MB
After many more hours i get it to export to an Order_.in file as required in text format, but the layout or formatting is incorrect. I changed the titles names to the actual field name in the table

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command18_Click()
  2. Dim MyDB As DAO.Database
  3. Set MyDB = CurrentDb
  4. Dim rst As DAO.Recordset
  5. Set rst = MyDB.OpenRecordset("rdmexport", dbOpenDynaset)
  6.  
  7. Open "C:\pisprg\order_.in" For Output As #1 ' Open file for output.
  8.  
  9. With rst
  10. .MoveLast
  11. .MoveFirst
  12. Do Until .EOF
  13. 'Print the contents of the first set of fields on the first line
  14. Print #1, !tblFacility_1_DemanderCode; Tab(8); !tblFacility_DemanderCode; Tab(16); !Order_No; Tab(26); !DemCodeT; Tab(32); !Icn; Tab(41); !OrderQty; Tab(51); !fms_code; Tab(52); !recurring_indicator; Tab(54); !use_loc_dem_no; Tab(56);
  15.  
  16.  
  17. If Not .EOF Then .MoveNext
  18. Loop
  19. Close #1 'Close the text file.
  20. .Close 'Close the recordset
  21. End With
  22.  
  23. Set rst = Nothing
  24. Set MyDB = Nothing
  25. End Sub
  26.  
The layout has to do with the "tab" in the code somehow. See attachment below pls Suggestions?
Attached Files
File Type: zip order_.zip (243 Bytes, 97 views)
Aug 28 '13 #2
ADezii
8,834 Expert 8TB
Export as a Delimited Text File, then Rename to proper Extension (.in), as in:
Expand|Select|Wrap|Line Numbers
  1. Const conPATH As String = "C:\pisprg\order_.txt"
  2.  
  3. 'Export as Text Delimited
  4. DoCmd.TransferText acExportDelim, , "rdmexport", conPATH, True, ""
  5.  
  6. 'Rename the File
  7. Name conPATH As Left$(conPATH, InStrRev(conPATH, ".")) & "in"
Aug 28 '13 #3
neelsfer
547 512MB
hi Adezii thx for the trouble
I get an error - runtime 3441
textfile specification field separator matches decimal separator or text delimiter
Please advise
Aug 28 '13 #4
zmbd
5,501 Expert Mod 4TB
neelsfer
hi Adezii thx for the trouble
I get an error - runtime 3441
textfile specification field separator matches decimal separator or text delimiter
Please advise
:This is a new question:
Text file specification field separator matches decimal separator or text delimiter. (Error 3441)
Text file specification field separator matches decimal separator or text delimiter. (Error 3441)
Two or more of the following delimiters settings used by the Text ISAM are the same:
  • TxtDelimiter
  • NumberDecimalSymbol
  • CurrencyDecimalSymbol
  • Format

You need to check the values in your recordset. At least one of the data entry has a symbol that matches the specified deliminator for the TXT/CSV file.
This normally happens when using the comma as a decimal point or visa/versa.
There's a fix for this, the specification file... been awhile since I used one so let me look at some anceint DB and see if I remember how those were made.
Aug 28 '13 #5
neelsfer
547 512MB
This problem has kept me busy for 3 evenings now. I also cannot see the advance button to set the "specification", when exporting manually.
Anybody with suggestions?
Aug 29 '13 #6
zmbd
5,501 Expert Mod 4TB
Ok,
Still working on this, I know that somewhere in the manual export you can get the Schema file to be created and saved... and there's now an XML version for this in at least 2010.

Here's just a little primer, not a lot of help, but better than sitting stuck in the mud :(

MSDN - Schema.ini File (Text File Driver)


[edit] Just found this too: Ramblings and other such stuff from Martin - Text file specification field separator matches decimal separator or text delimiter
Aug 29 '13 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Randy Henson | last post by:
I need to export certain fields of a table from sql 2000 into a dbf file, but can't find the proper query command to make it work. I also want to set this up to run each night automatically. ...
0
by: m00nm0nkey | last post by:
Hello! Using this MSDN Page as a reference - http://tinyurl.com/abkky - I am trying to create an instance of Excel, Import a fixed width file and save the file as an Excel Spreadsheet, in...
5
by: Reggie | last post by:
Hi and TIA! I have a query that I want to save as a fixed-width text file. I can get the export to work using an export specification with one exception. This is a government message and they need...
10
by: Neil | last post by:
Hi guyz, just trying out this google feature so if i post if in the wrong area i appologize. now to my question. BTW i'm new to access programming, i've done a little vb6.0 and vb.net but access...
0
by: gelangov | last post by:
I want to export a table into a "fixed width" file using SQL 2005 import export wizard. This is the version I have: SQL Server 2005 - 9.00.2047.00 For some reason it joins all the rows...
0
by: Vinny | last post by:
i'm not sure if this is the right group for this message, if not, i apologize. i have an application i'm writing which needs to bulk-load several million records into an sql server table. i'm...
1
by: Abhishek Bhatt | last post by:
Need to export table into csv file. Tried following: DoCmd.TransferText acExportDelim, "", TABLENAME, "C:\abc.csv", False, "" But the exported file contains data enclosed in double quotes i.e....
10
by: BostonNole | last post by:
Using Visual Studio 2005, .NET 2.0 and VB.NET: I am looking for the fastest possible way to import a very large fixed width file (over 6 million records and over 1.2 GB file size) into a...
0
by: Max | last post by:
Hi I am trying to export an Access table to a fixed-width text file. The table contains 2 memo fields of approx. 1000 characters each. I am using the 'Export text wizard' to export. In this...
1
by: peridian | last post by:
Hi, Quick question, I have a fixed width text file with over 1000 fields in it that I need to get into SQL Server 2000 (I have both enterprise manager and management studio). I have an excel...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.