Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2005

Tip: Looking for answers? Try searching our database.

Dumping crosstab query results to a file.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jay - 26 Jan 2005 18:45 GMT
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
Alex Dybenko - 26 Jan 2005 20:11 GMT
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

Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

>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
Andi Mayer - 26 Jan 2005 20:22 GMT
>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)
---
If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.