Results 1 to 7 of 7
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to Reference Form in Report? (A2k (9.0.3821) SR-1)

    I

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: How to Reference Form in Report? (A2k (9.0.3821) SR-1)

    You wrote:
    >>Is there another way I can recode the following report control so the form name is not hard coded?
    =[Forms]![frm_CR_ACD]![strAddrNo] & " " & [Forms]![frm_CR_ACD]![strAddrName]<<

    About the only thing you can do is to create a global variable to hold the address. YOu would then fill the variable prior to calling the report. Define the variable in any module, and call it something like gstrAddress. Prior to running the report, you would do this:
    gstrAddress = Me!strAddrno & " " & Me!strAddrName

    Then, you need to write a little function to recall the value of the variable in the query (you can't use global variables in queries or reports). Somthing like:

    Public Function getgstrAddress()
    getgstrAddress = gstrAddress
    End Function

    You report control would then just be: =getstrAddress( )
    Your query
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to Reference Form in Report? (A2k (9.0.3821) SR-1)

    Hi Mark

    Great solution.

    Though there might be someting like Me.Parent

    I like to use prior reports as templates for new reports with doing as little coding as posible.

    Thanks, John

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: How to Reference Form in Report? (A2k (9.0.3821) SR-1)

    What is the source of your report, is it a query?
    If the source is a query then you could change the query to show the concatenated field.
    Pat <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How to Reference Form in Report? (A2k (9.0.3821) SR-1)

    An alternate way to do it is by retrieving the value in the code behind the Detail section Format event and setting the value of an unbound textbox directly from code. That would allow you to create conditional statements based on the particular form that's open.
    Charlotte

  6. #6
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: How to Reference Form in Report? (A2k (9.0.3821) SR-1)

    >>Though there might be someting like Me.Parent<<

    I don't think this works on reports.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How to Reference Form in Report? (A2k (9.0.3821) SR-1)

    References to the Parent object can only be made in code in a form or report. You can't use them in a controlsource.
    Charlotte

Posting Permissions

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