Is there code to export to standard fixed length text file?

M

megalomaniac

I can do this manually but it's more than a couple clicks.

I'd like to automate this from the MDB that I can call from my C#
process call or an OLE call.

Thanks much!
 
J

John Nurick

AFAIK the choices are:

1) write code in your C# application that opens a recordset, assembles
the fixed-length records and writes them to a text file.

2) use the Jet Text ISAM to write the file, either by automating Access
or by writing to the DAO library. Either way you'll need to provide a
schema for the text file. The options are an Access import/export
specification stored in the mdb file, or a schema.ini file in the
destination folder.

The import/export spec is easy to create: start expoirting the data
manually, click the Advanced button in the wizard... but can only be
used with DoCmd.TransferText (i.e. requires you to automate Access
instead of just using DAO). Schema.ini is a bit more obscure, but is
simpler to create on the fly under program control. Because it's
recognised by the Jet Text ISAM, you can just use DAO instead of
automating Access.

Create a Schema.ini file based on an existing table in your database:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;155512
How to Use Schema.ini for Accessing Text Data
http://support.microsoft.com/default.aspx?scid=kb;EN-US;149090

Documentation for Schema.ini is towards the end of the Help topic
"Initializing the Text Data Source Driver" (under Microsoft Jet SQL
Reference).
 
M

megalomaniac

DOH!!!! (Head smacker!)

Wow, VS 2005 has a native ole db Jet driver to Access... Will the
miracles never cease...

I don't know why I try to stay away from ODBC or other type drivers
like they were plegue ridden and therefore never consider them, but I
really appreciated you input.

I'm rolling big time now...

Many thanks even if it was so simple and easy it was glaring at me in
the first place ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top