T
turks67 via AccessMonster.com
Someone was nice to put this code out there. The code works but I need to
print by month also.
In the query field i'm trying to filter the month using a combo box on a form
with forms!frmexceptprint!combo1. I the error msg is: too few parameters
expected 1.
Can someone help?
Private Sub cmd_Report_Click
Dim strSQL as string, strCriteria as string
Dim rs as DAO.Recordset
strSQL = "SELECT DISTINCT CustomerID FROM qry_Reports"
set rs = currentdb.openrecordset(strSQL,,dbfailonerror)
'loop through all of the customers
While not rs.eof
'this assumes you want to print the report
strCriteria = "CustomerID = " & rs("CustomerID")
docmd.OpenReport "reportname",acViewNormal,, strCriteria
rs.movenext
Wend
rs.close
set rs = nothing
End sub
print by month also.
In the query field i'm trying to filter the month using a combo box on a form
with forms!frmexceptprint!combo1. I the error msg is: too few parameters
expected 1.
Can someone help?
Private Sub cmd_Report_Click
Dim strSQL as string, strCriteria as string
Dim rs as DAO.Recordset
strSQL = "SELECT DISTINCT CustomerID FROM qry_Reports"
set rs = currentdb.openrecordset(strSQL,,dbfailonerror)
'loop through all of the customers
While not rs.eof
'this assumes you want to print the report
strCriteria = "CustomerID = " & rs("CustomerID")
docmd.OpenReport "reportname",acViewNormal,, strCriteria
rs.movenext
Wend
rs.close
set rs = nothing
End sub