how to enter print preview report's filter automatically from the current form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • isaace
    New Member
    • Jan 2012
    • 13

    #1

    how to enter print preview report's filter automatically from the current form

    I have an agreement template in a MS access report. The report's fields are populated by the form's records. my goal is to automate the report to filter to the agreement # to what ever the current agreement # on the form is. i do not want to have to enter the agreement # every time i click on the cmd function to preview the report. below is the code i have, can someone please edit my code to what it should be?

    Code:
    Private Sub Command99_Click()
    On Error GoTo Err_Command99_Click
    
    
    'Defines Variables:
        Dim stReportName As String
        Dim stFilter As String
            
        'stFilter = [Agreement#].Value
            
        stReportName = "rptLicenseAgreement"
        DoCmd.OpenReport stReportName, acPreview, , stFilter, acDialog
        
        
    Exit_Command99_Click:
        Exit Sub
    
    Err_Command99_Click:
        MsgBox Err.Description
        Resume Exit_Command99_Click
        
    End Sub
    thanks!
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    No. They can't. That is not an acceptable request here.

    Look at Example Filtering on a Form and learn to do it for yourself.

    Comment

    Working...