[RESOLVED] Access specification filetype for transfertext of CSVs
I'm trying to generate specifications files in Access automatically (in code) to handle different formats of CSV files.
i.e. I read in the 1st line containing the column names and then create a new spec in the MSysIMEXSpecs & MSysIMEXColumns tables to force all fields to come in as text.
It works fine except some files insist on a spec filetype in MSysIMEXSpecs of 1200 and others of 1252 and I can't figure out which wants what except by trial and error.
Apparently, 1200 is for unicode and the 1252 is Latin something.
Does anyone know if there's a way around this or if there's a way I can test the data file, via code, to see if it's unicode etc?
Thanks, DaveBo
Re: Access specification filetype for transfertext of CSVs
The FileType field in MSysIMEXSpecs table with Jet 4.0 and later is the code page to use.
See full listing of codepages here: Character Set Recognition
Beside that (not sure):
0 = Windows (ANSI)
1 = DOS or OS/2 (PC-8)
Re: Access specification filetype for transfertext of CSVs
I generally just manually import the .csv file first, and save the import spec there.
I realize you want to do it in code, so maybe that doesn't help you, but this way you won't have these errors.
Re: Access specification filetype for transfertext of CSVs
Thanks, that's helpful. The CodePage field from that "Character Recognition" table seems to be what the specification FileType wants in it.
Somehow, when doing a manual import and creating a spec from that it knows what value to use here. I was hoping I could do the same when creating my specs from code.
The strange thing is, when I auto-generate the spec and import the file with my routine it looks like it worked, but if the FileType setting is wrong the new table is empty.
Thanks, DaveBo
Re: Access specification filetype for transfertext of CSVs
If that helps you and your problem has been solved, please use thread tools to mark this thread as RESOLVED and you should rate the post that helps you.