Dumping crosstab query results to a file.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have a crosstab query and I need to in the beginning of my proceudure print
the output to a text file.
any tips since the columns are not necessarily the same each time...

TIA
 
You can use make-table query to save result of your query to temporate
table, then export thia table to text using docmd.transfertext or
docmd.OutputTo
 
i have a crosstab query and I need to in the beginning of my proceudure print
the output to a text file.
any tips since the columns are not necessarily the same each time...

TIA

pseudoCode:
redim ary(rs.fieldscount, rs.recordcount+1)
for each field in rs.fields
ary(field.ordinalposition,0)=field.name
next field
while not rs.eof
for each field in rs.fields
ary(field.ordinalposition,rs.absoluteposition)=field
next field

open "C:\OutputFile" for Output as #1
for i=0 to ubound(ary,2)
tmp=""
for z=0 to ubound(ary)
tmp=tmp &";" ary(z,i)
next z
tmp=mid(tmp,2)
print #1,tmp
next i
close #1

formating and error checking is up to you (and my syntax check too)
 
Back
Top