Originally Posted by
Ajax
look at using the transfertext function which you can call from a macro.
with regards your file naming requirements, I don't use macro's so can't advise, but in vba it would be something like
filename=[Type] & "_" & iif(left([origin],1)="n","CR_","") & right([date],4) & mid([date],3,2) & left([date],2) & [minutes] & "_" & [record number]
note that type, name and date are reserved words, if these are your real names I recommend changing them otherwise you will experience unexpected and misleading errors - putting square brackets round them helps but will not always solve the problem
for the bit about what goes into each text file, you will need to create a recordset of the filename elements (e.g. SELECT DISTINCT [Type], origin, [record number] from myTable)
then loop through this recordset to
1. build a query string - something like "select * from myTable where [Type]='" & rsth![type] & "' AND origin='" & rsth!origin & "' and [record number]=" & rsth![record number]
2. create and save a querydef with this sql string
3. use transfertext to export this query