ennumerating reports

cyberz

New member
Local time
Today, 07:11
Joined
Sep 10, 2002
Messages
7
hey,

why isn't this working? i can't seem to figure it out. it's reporting rep as null :S

Code:
Private Sub cmdReport_Click()
    'loads report for the selected party
    Dim checkReport As Boolean
    Dim rep As Report
    Dim reportname As String
    
    
        checkReport = False
        Set db = CurrentDb
        
        reportname = "rpt_" & partyNames & ""
        
        For Each rep In Reports
        If rep.Name = reportname Then
                checkReport = True
                Exit For
            End If
        Next
        
        If checkReport = True Then
            DoCmd.OpenReport reportname, acViewPreview
        Else
            DoCmd.CopyObject , reportname, acReport, "rpt_template"
            DoCmd.OpenReport reportname, acViewDesign
            Reports(reportname).RecordSource = "tbl_" & partyNames & "_reviewed"
            Reports(reportname).Controls.Item("label32").Caption = "Report On " & partyNames
        End If
End Sub

thanks :D

Martin
 

Users who are viewing this thread

Back
Top Bottom