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

  • Follow


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!

0
Reply megalomaniac 3/22/2006 9:07:06 PM

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).

On 22 Mar 2006 13:07:06 -0800, "megalomaniac"
<megalomaniacalgenius@gmail.com> wrote:

>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!
>

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.

0
Reply John 3/23/2006 6:26:18 AM

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 ;-)

0
Reply megalomaniac 3/25/2006 4:25:36 PM

2 Replies
703 Views

(page loaded in 0.043 seconds)


Reply: