SallyJenkins
Registered User.
- Local time
- Today, 12:52
- Joined
- Nov 2, 2012
- Messages
- 13
I have created a report that uses a table as its record source. I need to create individual pdf files for each fund in this table. There may be 2 to many pages of activity for each fund. Prior to opening the report I query the table to get distinct funid ids. I step through the query results and open the report, pass a parameter(fundid) using the Where clause (MS Access 2010 - mdb). I am expecting to see a single report for each fundid, but am seeing the entire report each loop through the list of fundid's. Is there someting on the report specification side I need to do for it to accept the parameter? BTW, the Fundid is text.
Here's the code:
Here's the code:
Code:
Dim Dbs As DAO.Database
Set Dbs = CurrentDb
Dim rsEndStatSumActs As DAO.Recordset
strSQL = "SELECT DISTINCT FundID FROM EndStatSumActs"
Set rsEndStatSumActs = Dbs.OpenRecordset(strSQL)
'Debug.Print "Records " & rsToAdd.RecordCount
If rsEndStatSumActs.RecordCount = 0 Then
' We have a problem
Else
Do While Not rsEndStatSumActs.EOF
strFundID = rsEndStatSumActs![FundId]
stCriteria = "[FundID] = '" & rsEndStatSumActs![FundId] & "'"
DoCmd.OpenReport "EndStatSumActs", acViewPreview, , stCriteria
rsEndStatSumActs.MoveNext
Loop
End If