TransferText - limiting number of records

davesmith202

Employee of Access World
Local time
Today, 08:07
Joined
Jul 20, 2001
Messages
522
I use the following code to export a query to a text file:

Code:
strQueryToExport = Me.lstQueryList.value
DoCmd.TransferText acExportDelim, "PGN Export Specification", strQueryToExport, strFile, True

A typical Query may have 10,000 records, but this is too many for me. Is there any way to limit the export to the first - for example - 2,000 records? Or can I limit the Query to show just the first 2,000 records?

Thanks,

Dave
 
If you design your source query and go to the properties you can limit the output by percentage or by number using the TOP amount.
 
Fabulous, thank you! Never knew that one.

Since I will be making a large number of queries, is there any way to do this via code? It would save me from having to edit each query I make and I will be making a lot of them!

I mean perhaps I could make a temp query somehow and use code to add the TOP amount.

How would I do that?
 

Users who are viewing this thread

Back
Top Bottom