Need to use TransferText maintaining db record order


In a VBA module, I am trying to use TransferText to export a table's records in fixed-length format using the order that the records appear in the table.  (The table is created by an update statement that inserts records in the order I need.)  However, when I use TransferText, the record order in the exported fixed width file does not appear as it does in the table.

I can force the order by creating a query by hand that specifies the order and then exporting the records, but I need it to work dynamically.

In short, is there a way to force the record order to when exporting to fixed-width using TransferText?  I suppose I could create a recordset and print out each record individually but calculating padding for a  fixed-width, 30 field record is going to get messy.
Who is Participating?
Creatae the Query and save it.
In your TransferText command, specify the Query, not the table name.
enriteAuthor Commented:
Hi aesmike,

Gah, duh...I just realized that when responding about how to dynamically create that query.  Of course, the data will change but not the query....


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.