G
graeme34 via AccessMonster.com
Hi I am attempting to loop through a query recordset printing a statement for
each record.
I have the following code..
Private Sub cmdPrintMonthlyStatements_Click()
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("qryAccountLoop")
Do Until rs.EOF = True
DoCmd.OpenReport "repMonthlyStatement", acViewPreview
DoCmd.Close acReport, acSaveNo
rs.MoveNext
Loop
Which works fine I think, its just the report is not what I expected...
On opening the report the report is showing details of each account record,
does the report need to be filtered at all ??? To show only the details of
the current record in the reocrdset......the control source query forthe
report header is the same as the recordset:
SELECT DISTINCT tblAccount.AccountIndex, tblAccount.AccountName, tblAccount.
[Account Address 1], tblAccount.[Account Address 2], tblAccount.[Account
Address 3], tblAccount.[Account Town / City], tblAccount.[Post Code],
tblAccount.CurrentBalance
FROM tblAccount INNER JOIN qryStatementLine ON tblAccount.AccountIndex =
qryStatementLine.AccountIndex
ORDER BY tblAccount.AccountIndex;
any suggestions??
each record.
I have the following code..
Private Sub cmdPrintMonthlyStatements_Click()
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("qryAccountLoop")
Do Until rs.EOF = True
DoCmd.OpenReport "repMonthlyStatement", acViewPreview
DoCmd.Close acReport, acSaveNo
rs.MoveNext
Loop
Which works fine I think, its just the report is not what I expected...
On opening the report the report is showing details of each account record,
does the report need to be filtered at all ??? To show only the details of
the current record in the reocrdset......the control source query forthe
report header is the same as the recordset:
SELECT DISTINCT tblAccount.AccountIndex, tblAccount.AccountName, tblAccount.
[Account Address 1], tblAccount.[Account Address 2], tblAccount.[Account
Address 3], tblAccount.[Account Town / City], tblAccount.[Post Code],
tblAccount.CurrentBalance
FROM tblAccount INNER JOIN qryStatementLine ON tblAccount.AccountIndex =
qryStatementLine.AccountIndex
ORDER BY tblAccount.AccountIndex;
any suggestions??