Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Set report name from an open form

Posted on 2011-02-22
2
Medium Priority
?
426 Views
Last Modified: 2013-11-27
Please see "What I want" below

Private Sub Report_Click()

    '                     >>>>>>>>>>>><<<<<<<<<<<<<<
   
    Dim stDocName As String
    Dim ctl As Control
    Dim rpt As Report
   

    stDocName = Forms![frmResize_Report]![InReport]    'InReport is a control on an open form.

    DoCmd.OpenReport stDocName, acDesign  'Opens report in design view.
   
   
    Set rpt = Reports!rptProfiles1
'What I want is to set rpt like
      'Set rpt = Forms![frmResize_Report]![InReport]
' i.e. read the value to which to set rpt from Forms![frmResize_Report]![InReport], because I want to change the code for each new report. Will it make it easier if I mede it into a function?


       
    '              >>>>>>>>>>Addressing Sections>>>>>>>>>>>
   
    On Error GoTo endofsections

    For i = 0 To 100
        Debug.Print rpt.Section(i).Name, rpt.Section(i).[Height]
    Next i

endofsections:
    ' exit on error because you can't tell in advance how many sections there are
    Exit Sub
   
End Sub
0
Comment
Question by:Fritz Paul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1000 total points
ID: 34950951
If you mean you wish to set your rpt Object to the report you opened:

Set rpt = Reports(stDocName)


0
 

Author Closing Comment

by:Fritz Paul
ID: 34951057
Fabulous!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

618 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