• CloseReport Command (2000 Sr-1)

    • This topic has 3 replies, 3 voices, and was last updated 22 years ago.
    Author
    Topic
    #386278

    Here is my code for Opening, then printing, then Closing the report.

    The end user wanted to be able to see the report, even for a second, then have it go away.

    Dim strReportName As String
    Dim strCriteria As String

    strReportName = “rptPrintRecord”
    strCriteria = “[AccCostNum]='” & Me![AccCostNum] & “‘”
    DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
    DoCmd.OpenReport strReportName, acViewPrint, , strCriteria
    DoCmd.CloseReport “rptPrintRecord”

    End Sub

    I get a Compile Error: ‘Method or Data Member’ not found and the ‘CloseReport’ is highlighted

    Please help

    Paul

    Viewing 1 reply thread
    Author
    Replies
    • #669552

      I’m just guessing since my VBA knowledge is just enough to be dangerous, but shouldn’t your last line say
      DoCmd.CloseReport strReportName

      instead of “repPrintRecord”?

      If that’s where the de###### is hanging it seems like you need to be consistent and use the same syntax with Close as you did with Open.

      Peter

    • #669555

      There is no method CloseReport. Instead, use Close:

      DoCmd.Close acReport, strReportName

    Viewing 1 reply thread
    Reply To: CloseReport Command (2000 Sr-1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: