Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 396
  • Last Modified:

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.
1 Solution
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....



Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now