Good Day All,
I am passing a recordset variable as a byref parameter and it would not work.
Is there a special way to accomplish this objective?
Here is my code:
I am passing a recordset variable as a byref parameter and it would not work.
Is there a special way to accomplish this objective?
Here is my code:
Code:
Public Sub SumSalesAccounts(ByRef rst As Recordset)
Dim curDatabase As Database
Dim strSql As String
Dim Number As Integer
strSql = "SELECT Sum(Quantity) AS SumQty, Account, Sum([Extended Price]) AS SumPrice, code3 " _
& "FROM [Chart of Accounts] INNER JOIN [Order Details Extended] ON [Chart of Accounts].[Account Name] = [Order Details Extended].Account " _
& "WHERE [Order ID]= 201 GROUP BY Account, [Order ID], code3;"
Debug.Print strSql
Set curDatabase = CurrentDb
Set rst = curDatabase.OpenRecordset(strSql)
Do While (Not rst.EOF)
MsgBox rst.Fields(0) & " " & rst.Fields(1) & " " & rst.Fields(2)
rst.MoveNext
Loop
Set rst = Nothing
Set curDatabase = Nothing
End Sub
Last edited: