Why report printing a blank page?

Posted on 2014-08-26
Last Modified: 2014-08-29
I have a report which has a sub-report.  The subreport's record source is a query.  In the query is a field named inactive.  If the record is inactive then the query does not reflect that particular record.  This is working fine.

But I have the following code in the onformat event of the subreport.  The problem is... the report is printing a blank page for the record that is inactive.  Why would this be happening?

Here is the code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Dim n As Integer
    Dim strClientFolderName As String
    Dim strFileName As String
    Dim strPropertyAssetFolderName As String
    Dim strPropertyFolderName As String
    Dim strPropertyRoomName As String

    n = 1
    strClientFolderName = TempVars!strPicturesDataPath & "\" & Trim(Me.txtClientTableID) & "\"
    strPropertyFolderName = strClientFolderName & Trim(Me.txtPropertyTableID) & "\"
    strPropertyRoomName = strPropertyFolderName & Trim(Me.txtRoomDetailID) & "\"
    strPropertyAssetFolderName = strPropertyRoomName & Trim(Me.txtManualAssetN)

    Me.AssetImage1.Picture = strPropertyAssetFolderName & "\" & Me.PrimaryPictureFile
    Me.AssetImage2.Picture = ""
    Me.AssetImage3.Picture = ""
    Me.AssetImage4.Picture = ""

    strFileName = Dir(strPropertyAssetFolderName & "\")
    Do While strFileName <> ""
        If strFileName <> Me.PrimaryPictureFile Then
            Select Case n
                Case 1
                    Me.AssetImage2.Picture = strPropertyAssetFolderName & "\" & strFileName
                Case 2
                    Me.AssetImage3.Picture = strPropertyAssetFolderName & "\" & strFileName
                Case 3
                    Me.AssetImage4.Picture = strPropertyAssetFolderName & "\" & strFileName
                Case Else
            End Select
            n = n + 1
        End If
        strFileName = Dir

End Sub

Open in new window

Question by:SteveL13
    LVL 56

    Accepted Solution

    <<Why would this be happening?>>

      Not quite sure I say the inactive record is not in the result set, but your still getting a section for it?   Do you have different filtering setup in the report?

     What I would suggest is that you put a STOP at the top of the code and then walk through the code.  Use F5 to continue on when you hit a record that your sure should print and F8 to step through the code when you hit the blank page.

      You can do this in preview as well and jump to the page in question (use the page number control at the bottom), instead of going page by page.

     Sounds to me though like either:

    a. Your not getting the result set you expect.

    b. Something other than an inactive record is causing a blank page and you just think it's an inactive record (your result set is correct).


    Author Closing Comment

    This helped me get to the solution.  Thanks.

    "What I would suggest is that you put a STOP at the top of the code and then walk through the code.  Use F5 to continue on when you hit a record that your sure should print and F8 to step through the code when you hit the blank page."

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Updating recordset in Access VBA 13 44
    Show Balance 3 15
    Open Args 16 24
    MS Access Parse and Return File Path Name Only 16 10
    In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
    QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
    In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
    With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now