[AccessD] 2 qstions: Create table using UNION; Export to flatfile

S D accessd667 at yahoo.com
Wed Oct 27 01:43:18 CDT 2004


Hi Gustav,
 
thnx for you're reply. I found out that the app I'm modifying is using the following command to export to textfiles and I do not want to introduce a new way of exporting for 1 extra export:

DoCmd.TransferText [transfertype][, specificationname], tablename, filename[, hasfieldnames][, HTMLtablename][, codepage]

Now I have 2 problems.
Problem 1: The help file says that when you use a delimited export you do not need a specificationname (see below).
However when I use this command:
DoCmd.TransferText acExportDelim, , "tSapExport", "c:\sapexport.txt"
I get the following error:
3441 Text file specification field separator matches decimal separator or text delimiter
 
I have no idea what to do with this error. (tried M$, msdn, and even google ;-))
 
Problem 2: I do not know how to create a specification file.
Any idea how to create such a file?
 
TIA
Sander
 
Helpfile info regarding specification field :
For a fixed-width text file, you must either specify an argument or use a schema.ini file, which must be stored in the same folder as the imported, linked, or exported text file. To create a schema file, you can use the text import/export wizard to create the file. For delimited text files and Microsoft Word mail merge data files, you can leave this argument blank to select the default import/export specifications.

Gustav Brock <gustav at cactus.dk> wrote:
Hi S

> First question:
> I need to create a table using a UNION query. How can I do this?

Create a union query, then use that as source for the append/create
query.

> Second question:
> I need to create a TAB-delimited flatfile using the table created above. How do I do that?

Create a query something like this:

SELECT
Field1,
Field2
INTO
[Text;Database=C:\Windows\Temp].[YourFile.txt]
FROM
YourTable;

Before running this, create (or modify) the file schema.ini in the
destination folder:

[YourFile.txt]
ColNameHeader=False
CharacterSet=ANSI
Format=TabDelimited
Col1=Field1 Char Width 50
Col2=Field2 Char Width 50

The output file (YourFile.txt) must not exist before you run the
query.
As you can see, you may not need the temp table at all; use the union
query as source when creating the text file.

For more into on schema.ini file syntax, look here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcjetschema_ini_file.asp

/gustav

-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

		
---------------------------------
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now.


More information about the AccessD mailing list