[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 308
  • Last Modified:

Why report printing a blank page?

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
    Loop

End Sub

Open in new window

0
SteveL13
Asked:
SteveL13
1 Solution
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
<<Why would this be happening?>>

  Not quite sure I understand....you 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).

Jim.
0
 
SteveL13Author Commented:
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."
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now