T
tmuhammad
Hi
I need some routines to write to excel, I need to create an excel workbook
then create multiple worksheets for each customer write data to them, if
someone can please help me add this routine to the following code that wll
be greatly appreciated - thanks
If PostgreSQLADOConnection() Then 'This is my global connection
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
worksheet name
'Then print some heading and adding some formatting
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
'At the end of the reports sum of amount
objOrdADO.MoveNext
Loop
objIdADO.MoveNext
Loop
Set objTestADO = Nothing
Set cPostgreSQL = Nothing
End If
I need some routines to write to excel, I need to create an excel workbook
then create multiple worksheets for each customer write data to them, if
someone can please help me add this routine to the following code that wll
be greatly appreciated - thanks
If PostgreSQLADOConnection() Then 'This is my global connection
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
worksheet name
'Then print some heading and adding some formatting
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
'At the end of the reports sum of amount
objOrdADO.MoveNext
Loop
objIdADO.MoveNext
Loop
Set objTestADO = Nothing
Set cPostgreSQL = Nothing
End If