Subreport On No Data event

Discussion in 'Access VBA Modules' started by lmcc via AccessMonster.com, May 31, 2010.

  1. I have a report with a subreport. Sometimes the subreport has data and
    sometimes it does not.

    If the subreport has no data, I want the lblAdditionalAddresses label to not
    be visible. In the subreport On No Data even I entered the following code:

    Reports![rptCompanyProfile]![lblAdditionalAddresses].Visible =
    False

    It is not working.

    How can I get this to work?

    Thanks.

    --

     
    lmcc via AccessMonster.com, May 31, 2010
    #1
    1. Advertisements

  2. lmcc via AccessMonster.com

    Allen Browne Guest

    Right-click the lblAdditionalAddresses, and Change To | Text Box.

    Set its Control Source property to:
    =IIf([Sub1].[Report].[HasData], "Addresses:", Null)
    substituting the name of your subreport for Sub1.

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia

    Reply to group, rather than allenbrowne at mvps dot org.


    "lmcc via AccessMonster.com" <u59647@uwe> wrote in message
    news:a8cce455d5a21@uwe...
    > I have a report with a subreport. Sometimes the subreport has data and
    > sometimes it does not.
    >
    > If the subreport has no data, I want the lblAdditionalAddresses label to
    > not
    > be visible. In the subreport On No Data even I entered the following
    > code:
    >
    > Reports![rptCompanyProfile]![lblAdditionalAddresses].Visible =
    > False
     
    Allen Browne, May 31, 2010
    #2
    1. Advertisements

  3. Thanks, that did it!

    Allen Browne wrote:
    >Right-click the lblAdditionalAddresses, and Change To | Text Box.
    >
    >Set its Control Source property to:
    > =IIf([Sub1].[Report].[HasData], "Addresses:", Null)
    >substituting the name of your subreport for Sub1.
    >
    >> I have a report with a subreport. Sometimes the subreport has data and
    >> sometimes it does not.

    >[quoted text clipped - 6 lines]
    >> Reports![rptCompanyProfile]![lblAdditionalAddresses].Visible =
    >> False


    --

     
    lmcc via AccessMonster.com, May 31, 2010
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.