Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CloseReport Command (2000 Sr-1)

    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

  2. #2
    4 Star Lounger
    Join Date
    Dec 2002
    Location
    Kitchener, Ontario, Canada
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: CloseReport Command (2000 Sr-1)

    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

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: CloseReport Command (2000 Sr-1)

    There is no method CloseReport. Instead, use Close:

    DoCmd.Close acReport, strReportName

  4. #4
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: CloseReport Command (2000 Sr-1)

    Thanks HANSV. That worked!!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •