Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export data report by record 1

Status
Not open for further replies.

Moogles

MIS
Oct 6, 2002
37
US
Hi,

Is it possible to export a data report of 100 records into 100 report files (plain text) instead of 1 big report? I also would like to automate this in VB code which will pick up filename dynamically.

Any help is deeply appreciated!

TIA
 
Anything is possible given the right amount of time.

Can you give me a little more detail about what you are asking?

What is the "data report of 100 records" that your are talking about? Is it entries in a Database, an excell spread sheet, comma delimited file?

 
Thanks for your quick response!

I have an oracle package as the recordset for a DataReport which could returns more than 100 records from DB. If I click the already exist export button on the DataReport, it will export the 100 records in a big report. I wish to export it into 100 text files using VB code. Hope this is clearer?!

TIA
 
sorry it took so long for me to come back to you...had ISP problems.

If I read this correctly you have an existing Oracle database.
You want to make a connection to it, create a recordset within your program and then save it as text files someplace else.

If I am correct in what you are saying this is very simple.

Make a connection to the database.

Use a while not eof loop to iterate through the recordset.
Using the File System Object you can create a series of files named file1, file2 etc. create a string from the recordset and then write to the file.

psuedo code would look like this.

create a connection object
create an FSO object
create an integer to count with
create a working string to save in your file

set the workingString to ""
set the integer value to 1
open connection to database

while you are not at the end of the database do this
create a file named "file" & integer in the location you want it saved
build the workingString from the data in the current recordset.
write the workingstring to the file
set the workingString to ""
add 1 to the integer
advance the recordset with a movenext
end the while statement
close the recordset
close the connection to the database
set the recordset to nothing
set the connection to nothing
end your subroutine


There are plenty of examples here for using the FSO so I won't repeat them.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top