Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2011
    Posts
    7

    Unanswered: Passing data to subreport

    I currently have a button that triggers the following code:

    Code:
    Private Sub cmdPrint_Click()
        Dim strWhere As String
    
        If Me.Dirty Then    'Save any edits.
            Me.Dirty = False
        End If
    
        If Me.NewRecord Then 'Check there is a record to print
            MsgBox "Select a record to print"
        Else
            strWhere = "[ID] = " & Me.[ID]
            DoCmd.OpenReport "CoC1", acViewPreview, , strWhere
        End If
    End Sub
    Works great, except I have a situation where I need to print OLE objects that are as large as a page. The limitation of a report is 22 inches, so I am having to use subreports.

    Can anyone give me an idea of a command that is similar to the one above DoCmd.OpenReport that I can use to pass the values from strWhere to the subreport (without opening it).

  2. #2
    Join Date
    Oct 2011
    Posts
    7
    Code:
    Private Sub cmdPrint_Click()
        Dim strWhere As String
    
        If Me.Dirty Then    'Save any edits.
            Me.Dirty = False
        End If
    
        If Me.NewRecord Then 'Check there is a record to print
            MsgBox "Select a record to print"
        Else
            strWhere = "[ID] = " & Me.[ID]
            DoCmd.OpenReport "CoC1", acViewPreview, , strWhere
            DoCmd.OpenReport "Page2Image", acViewPreview, , , acHidden, strWhere
        End If
    End Sub
    Last edited by Varadin; 10-11-11 at 17:32.

  3. #3
    Join Date
    Oct 2011
    Posts
    7
    Tried using the above code, and it's still not quite right. Anyone have any ideas of how to directly pass form data to subforms?

Posting Permissions

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