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---