473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Need help with opening excel worksheets and text files

Hi friends

I need routines to create an excel file with worksheets for each
customer and a text file as well for each customer, first worksheet
would be a "Summary Report", here is the code that would get the data
for me I would appreciate if someone can add routines to create excel
and text files to it, the columns in text file need to be "|"
separated - thanks ever so much for all the help I have been getting
from this wonderful forum :

---Code---

If PostgreSQLADOConnection() Then

Dim objIdADO As ADODB.Recordset
dim objOrdAdo As ADODB.Recordset
Dim sqlStrID As String
Dim sqlStrOrders as string

Set oConn = CurrentProject.Connection
Set cn = cPostgreSQL

sqlStrID = "SELECT id FROM tblCustomers order by id"
Set objIdADO = cPostgreSQL.Execute(sqlStrID)

Do While Not objIdADO.EOF

'Here I need the code to open worksheets for each customer
id as the name and also a text file
'Then print some heading and adding some formatting to both
excel worksheet and text file

sqlStrOrders = "SELECT order_id, qty, unit_price, amount
FROM tblOrders WHERE customer_id = " & objIdADO("id")
Set objOrdAdo = cPostgreSQL.Execute(sqlStrOrders)

Do While Not objOrdADO.EOF

'Here I need the code to print orders recordset to
customers worksheet and textfile
'At the end of the reports sum of amount

objOrdADO.MoveNext
Loop

objIdADO.MoveNext
Loop
Set objIdADO = Nothing
Set objOrdADO = Nothing
Set cPostgreSQL = Nothing
End If

---Code---
Nov 12 '05 #1
1 1919
mr****@hotmail.com (mr_ocp) wrote in message news:<7e**************************@posting.google. com>...
Hi friends

I need routines to create an excel file with worksheets for each
customer and a text file as well for each customer, first worksheet
would be a "Summary Report", here is the code that would get the data
for me I would appreciate if someone can add routines to create excel
and text files to it, the columns in text file need to be "|"
separated - thanks ever so much for all the help I have been getting
from this wonderful forum :


One thing you could do is transfer the recordset from Access directly
to Excel, and then save using automation maybe.

For writing the thing to a text file, see Open/Write/Close etc. You
could just walk the columns collection of the recordset for each
record and write that value to a string variable and just throw in
your delimiter between each column value.
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Krmpotic | last post by:
hi!! I use the following code to operate excel document: Excel.Application excelApp = new Excel.ApplicationClass(); //excelApp.Visible = true; string workbookPath = "c:\\eltina.xls";...
3
by: Otie | last post by:
I found the following under the GetObject help notes and in the example for GetObject: "This example uses the GetObject function to get a reference to a specific Microsoft Excel worksheet...
1
by: mr_ocp | last post by:
Hi friends I need routines to create an excel file with worksheets for each customer and a text file as well for each customer, first worksheet would be a "Summary Report", here is the code that...
5
by: Iris | last post by:
I have 8 text files (tab delimited) that I would like to import into an Excel workbook as 8 individual worksheets but I cannot find any example code on this subject. Can anyone help me please???? ...
4
by: Powerguy | last post by:
Hi all, I've spent countless hours trying to get this silly EXCEL process to close once I have used it. If anyone can help it would really REALLy be appreciated! Below is my code- Dim t As...
3
by: dan_roman | last post by:
Hi, I developed a script with a nice interface in Tkinter that allows me to edit some formulas and to generate an Excel worksheet with VBA macros within it. The script runs perfectlly in Office...
9
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result...
10
by: Esmael | last post by:
Hi to all, /*****************************/ OS-WIn XP SP2 VB6 SP6 /*****************************/ Is their anyone who can help me with this: Source code written on VB6.
3
by: blerina | last post by:
hi, i have a simple asp code that opens an excel file. it works fine with simple excel files that don't contain formula. i think the problem is that my excel file contains formulas and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.