The query does not produce duplicates:
I'm not sure if this is a Report question or a Form question!!!!!
I'm thinking it's a form question: The code below is the code behind the
button to lauinch the report. Am I missing something that is producing
duplicates when one reviewer is choosen????
Private Sub cmdHMO_Click()
On Error GoTo Err_cmdHMO_Click
Dim stDocName As String
'these need to be declared
Dim stReviewerList As String
Dim stLinkCriteria As String
'first time thru loop?
Dim FirstTime As Boolean
Dim stReviewer As Variant
stDocName = "r_KeyMembers"
stReviewerList = ""
'dates
If IsNull(txtStart) Or IsNull(txtEnd) Then
MsgBox "You must enter Start and End Dates"
Exit Sub
End If
'Reviewer
FirstTime = True
For Each stReviewer In ListReviewer.ItemsSelected
If FirstTime Then
stReviewerList = "In('" & ListReviewer.ItemData(stReviewer) & "'"
FirstTime = False
Else
stReviewerList = stReviewerList & ",'" & ListReviewer.ItemData(stReviewer) &
"'"
End If
Next stReviewer
If Not FirstTime Then
stReviewerList = stReviewerList & ")"
End If
'create criteria string
'stReviewerList
If Len(Trim(Nz(stReviewerList, ""))) > 0 Then
stLinkCriteria = stLinkCriteria & "[Reviewer] " & stReviewerList & " And """
End If
'now remove the last 'And' and spaces
stLinkCriteria = Left(stLinkCriteria, Len(stLinkCriteria) - 5)
'open report in preview mode AND send it email
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
'DoCmd.SendObject acReport, stDocName, acFormatRTF, , , , , , True
Exit_cmdHMO:
Exit Sub
Err_cmdHMO_Click:
Err_cmdHMO:
MsgBox "You must pick at least one reviewer"
Resume Exit_cmdHMO
End Sub
StrayBullet via AccessMonster.com said:
Check the underlying query. Does it also duplicate those records? If so, your
adjustments need to be made there.
My report produces too many pages.!
The report is executed by a button on a form. The code behind the button
specifies Criteria, date ranges, employee and the report to open.
Only two pages should print, but it returns 1-20. pages 1&2 keep getting
duplicated (2&3, 4&5, 6&7....) are dups of 1&2...
My report has a Report Header, Page Header. Detail, Page Footer, Report
Footer.
In the Page Footer I have this statement: ="Page " & [Page] & " of " &
[Pages]...
Why are I getting 20 pages???????