using schema.ini

cheaster

Registered User.
Local time
Today, 08:18
Joined
May 28, 2009
Messages
13
hi

i wrote a macro which write a table datas to csv file and i would like to use a schema.ini but this row doesn't work:

DoCmd.TransferText acExportDelim, "C:\p\Schema.ini", "t_le", "C:\p\sz.csv", True

the error message said: this string specification isn't.

a tried
DoCmd.TransferText acExportDelim, "Schema.ini", "t_le", "C:\p\sz.csv", True
and
DoCmd.TransferText acExportDelim, "Schema", "t_le", "C:\p\sz.csv", True
but the error message was the same

Thank you
 
I never use Schema's, I simply use a Specification to be saved inside the DB. However posting twice the same question is not a good idea... So I am going to ask this thread be locked/deleted and any answers go in this thread:
http://www.access-programmers.co.uk/forums/showthread.php?p=848168#post848168

As that seems to be a more logical place to ask this question anyways.

Good luck!


sory but i really need the answer.
i would like to use schema.ini because a would like to set the delimiters, the date format and the decimal point, because in other computers the regional setting is other, nd I need the same delimiters
 
The syntax is

Code:
   DoCmd.TransferText acExportDelim, "Spec Name", "Table Name", "Full Path and File Name including extension", True, ""
 
sory but i really need the answer.
i would like to use schema.ini because a would like to set the delimiters, the date format and the decimal point, because in other computers the regional setting is other, nd I need the same delimiters

You can do all of that in the normal specifications as well :confused:
 
The syntax is

Code:
   DoCmd.TransferText acExportDelim, "Spec Name", "Table Name", "Full Path and File Name including extension", True, ""


my code is:
DoCmd.TransferText acExportDelim, "Schema.ini", "t_le", "C:\p\sz.csv", True, ""
where t_le is a table

and i would like to use schema.ini as spec name but it doesn't work.

the error message is the same.
So the code doesn't export the table and i can't find any working example
 
It sounds like Access does not like the naming convention "Schema.ini" as an Export specification name. Have you actually created one. If you are expecting Access to translate the table into an ini file then you need to redress your thinking.


In your code you are nominating the name of the spec, you actually have to have one already saved to be used for the export. Access is looking for it and can't find it that's why you are getting an error. If you simply leave the name blank it will use the default setting. This is clearly stated in the macro instructions

MS Help States:
The specification name for the set of options that determines how a text file is imported, exported, or linked. 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.
You can use the Import or Link Tables subcommand of the Get External Data command or the Export command on the File menu to create a specification for a particular type of text file; for example, a delimited text file that uses tabs to separate fields and has an MDY format for dates. When you click one of these commands and select a type of text file to import, export, or link, the Import Text Wizard, Export Text Wizard, or Link Text Wizard runs. You can click the Advanced button in the wizard and define and save a specification in the dialog box that appears. You can then type the specification name in this argument whenever you want to import or export the same type of text file.

You can import, export, or link delimited text files without typing a specification name for this argument. In this case, Access uses the defaults from the wizard dialog box. Access uses a predetermined format for mail merge data files, so you don't ever need to type a specification name for this argument when you export these types of files. You can use import/export specifications with HTML files, but the only part of the specification that applies is the specification for data type formatting.

Lets look at this from another angle. You want to create a file that will act as an ini file.

If you use your table as a recordset and enumerate through it 1 record at a time and employ the

Open "C:\Temp\Schema.ini" For Input As #1

Print #1, Your details
etc

Close #1

What does the table contain in the way of data?
 
i have got a table. this table contain
article number, storehouse number, store level, date

i have got a query which choose from the table datas, which article number is the same as the user select in the form.

i would like to write the result of this query into the csv file, and I would like to use the schema.ini as a spec name, because in this ini file a can set the delimiters and date type and then the access write the same structure in any computer, it doesn't matter what is the regional setting. so if i set the text delimiter as ; then in every computer the csv file separated with ;

but the access doesn't accept my code
 
Just use a normal Spec?

how can i use the norma spec?

if i use the normal spec then the delimiter depends the regiuonal settings, doesn'T?

when i leave the spec name then the delimiters was the same as the regional setting, and this case doesn't good for my, because then the users must always set the Regional settings, and i would like to avoid this
 
NO IT DOESNT I have been saying that...
Import the file manually once:
- File > Get external data > Import
- Find and select the file
- Walk thru the Wizard, untill you press "Finish" and stop there.
- Click advanced
- Click Save as, give it a <name> and save.

Now use above <name> in your transfertext command and you are good to go.
You can specify the record seperator (,;|~)
Date seperator /-
Even the order of the dates (dmy/mdy/ymd/etc)
Even decimal seperator and 4 or 2 didget years...

Most anything you want is right there at your finger tips!
 
NO IT DOESNT I have been saying that...
Import the file manually once:
- File > Get external data > Import
- Find and select the file
- Walk thru the Wizard, untill you press "Finish" and stop there.
- Click advanced
- Click Save as, give it a <name> and save.

Now use above <name> in your transfertext command and you are good to go.
You can specify the record seperator (,;|~)
Date seperator /-
Even the order of the dates (dmy/mdy/ymd/etc)
Even decimal seperator and 4 or 2 didget years...

Most anything you want is right there at your finger tips!

ok but select which file? and where can I specify the separators?
 
The file you want to import using your code, you only do this once manually to setup the specification.

Just run thru the wizard and look at the different screens it throws you, you will find it, from memory it is something like:
1)
Pick between a seperated or Fixed width file => Seperated ofcourse in this case
2)
What is the seperator? default options: [Tab] ; , [space] or Other (per your owns specification)
 
The file you want to import using your code, you only do this once manually to setup the specification.

Just run thru the wizard and look at the different screens it throws you, you will find it, from memory it is something like:
1)
Pick between a seperated or Fixed width file => Seperated ofcourse in this case
2)
What is the seperator? default options: [Tab] ; , [space] or Other (per your owns specification)

but i have a table full with datas, and i want export datas to csv file and i want to set the separators which the access write into the csv file

haven't got any example where select datas from table and export to csv file using the schema.ini?
 
Can you post a copy of your mdb

i write now an example but this isn't work
my table name: adat
adat adat cikkszam datum 1 5/5/2009 5 5/5/2008
my Schema.ini:

[sz.txt]
Format=CSVDelimited
ColNameHeader=True
MaxScanRows=0
CharacterSet=OEM
Col1="cikkszam" Char Width 10
Col2="datum" Date Width 9

i have got a query l and the result:
l l cikkszam datum 1 5/5/2009 5 5/5/2008 so select the whole table

and my code:
DoCmd.TransferText acExportDelim, "Schema.ini", "l", "c:\acc\sz.txt", True, ""

this is just an example what I write quickly, but if you can solve this problem then a can use this example for my real database

thanks
 
but i have a table full with datas, and i want export datas to csv file and i want to set the separators which the access write into the csv file

haven't got any example where select datas from table and export to csv file using the schema.ini?

OK Export.... sorry... so what? Same procedure, same solution... You can still specify the seperators and what not exactly the same way in the Spec!
Only thing that changes is File > Import to File > Export
All the rest stays the same... I repeat: STAYS THE SAME

I repeat again: Just use a spec inside the database!
 
DoCmd.TransferText acExportDelim, "Schema.ini", "l", "c:\acc\sz.txt", True, ""

As I have explained before "Schema.ini" is NOT a valid name for an import/export specification name. If you was to go into Advanced and try to save a spec using that name Access would not let you. So why are you insisting on using this name?

David
 
If you was to go into Advanced and try to save a spec using that name Access would not let you. So why are you insisting on using this name?
David,

Somehting you may not know, but it IS possible to tell Access how to import a file using an external specification. This specification is called a Schema. This "schema.ini" is this file he is refering to.

There are a lot of issues with is thing I have seen it work, so I know it works. But it is the hard and long way around, like going Amsterdam > Madrid but by way of Amsterdam > Berlin > Rome > Madrid

Internal specifications can and will do what he wants, just as soon as he (or she) can find the time to quit beeing stubburn and listen to us "pro's"
(Dont mean to insult/hurt or anything along those lines...)
 
DoCmd.TransferText acExportDelim, "Schema.ini", "l", "c:\acc\sz.txt", True, ""

As I have explained before "Schema.ini" is NOT a valid name for an import/export specification name. If you was to go into Advanced and try to save a spec using that name Access would not let you. So why are you insisting on using this name?

David

i don't insist for this name but a see this on the access help a i thought that i must use this name. for other name the code is successfull?
 

Users who are viewing this thread

Back
Top Bottom