IIF statment returns #NAME? error in controls for subreports

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • codicecrm
    New Member
    • Mar 2010
    • 14

    #1

    IIF statment returns #NAME? error in controls for subreports

    am trying to create a main report containing several subreports in Access 2003, all based on individual queries. The data for each subreport actually displays just fine, but I am having problems with controls in two places. The first is a "summary" page that ought to display the title of each subreport along with the number of records in each respective subreport, ex.

    New Safety Concerns 30
    All Closed Concerns 40 - etc, etc.

    I have the following IIF statement placed in a textbox to return the value of a labeled (*)count text box that resides within the subreport:

    Code:
    =IIf(RPT_NEW_SAFETY.Report.HasData,RPT_NEW_SAFETY.Report![New Safety],0)
    This codes functions for the first subreport, but returns the #NAME? error for the rest.
    The other error occurs in a textbox containing a different IIF Statement to identify if a report has no data:

    Code:
    =IIf([RPT_NEW_SAFETY].[Report].[HasData]=True,Null,"None.").
    Again, it works for the first subreport, but returns the #NAME? error for the rest.
    I've attached the zipped db for further study, if anyone cares to take a look. But please forgive my novice design!
    Attached Files
    Last edited by Niheel; May 5 '10, 07:28 AM. Reason: code tags, spacing
  • patjones
    Recognized Expert Contributor
    • Jun 2007
    • 931

    #2
    I don't see the zipped database. I'd be happy to look at it if you can post it.

    Judging by the fact that both of these statements work in the first sub-report and not the rest, I would take a look at what is different about the first sub-report that makes it work correctly - the recordsource, for instance.

    Pat

    Comment

    • codicecrm
      New Member
      • Mar 2010
      • 14

      #3
      Originally posted by zepphead80
      I don't see the zipped database. I'd be happy to look at it if you can post it.

      Judging by the fact that both of these statements work in the first sub-report and not the rest, I would take a look at what is different about the first sub-report that makes it work correctly - the recordsource, for instance.

      Pat
      Sorry about that - it's there now! Thanks! :)

      Comment

      • patjones
        Recognized Expert Contributor
        • Jun 2007
        • 931

        #4
        Great! I will take a look at it tonight on one of my machines at home...

        Pat

        Comment

        • codicecrm
          New Member
          • Mar 2010
          • 14

          #5
          Originally posted by zepphead80
          Great! I will take a look at it tonight on one of my machines at home...

          Pat
          Please forgive the crudeness - I know there are other errors I need to fix, but the two I mentioned are the ones I absolutely cannot figure out.
          Thank you so much!

          Comment

          • codicecrm
            New Member
            • Mar 2010
            • 14

            #6
            Originally posted by zepphead80
            Great! I will take a look at it tonight on one of my machines at home...

            Pat
            Please don't waste any more time on this until I sort out the names of my controls in the report. I discovered a huge hole in my understanding of control names and report names - primarily that they aren't synonymous!
            Anyway - I don't believe I even indicated the name of the report to which I'm referring, which is Charlie btw. I'll pick back up in the morning and let you know what I find. HUGE thanks! :)

            Comment

            • codicecrm
              New Member
              • Mar 2010
              • 14

              #7
              Originally posted by codicecrm
              Please don't waste any more time on this until I sort out the names of my controls in the report. I discovered a huge hole in my understanding of control names and report names - primarily that they aren't synonymous!
              Anyway - I don't believe I even indicated the name of the report to which I'm referring, which is Charlie btw. I'll pick back up in the morning and let you know what I find. HUGE thanks! :)
              It works! I modified my subreport control names in the detail of the main report, and the code now works for all of the controls! A million thanks again for looking at it! :)

              Comment

              Working...