Results 1 to 5 of 5
  1. #1
    EHittner is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    32

    Error Message Result In Count Formula

    I have a form with a header and detail section. In the header, I created an unbound field that I want to display a count of only certain types of records in the detail. This has worked for me before, but for some reason, when I copy it to a new form, it only comes up with a "#Error" result.



    The formula I'm using is: =Count(IIf([FormNumber]="551",1,0))

    The list in the detail has a few different "FormNumber" types, and I'd like to keep a separate count of each.

    Any ideas as to why this gremlin keeps popping up on me?

    NOTE: I failed to update my profile. I'm using Access 2010 on Windows 7 (both 64 bit).

  2. #2
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    One of the stupid things about Access is that, when you copy a form, sometimes it will rename a control to a generic name, if there's no code referencing the control. So, check the name of the relevant control on your fresh copy of the form, and if it has been changed to something else (like "Text9"), then change it back to [FormNumber]. Your Count will then work.

    The way I've found to prevent that auto-rename is a cheat - I put a subroutine in the form's module that does a debug.print on a value of a single property of each control. I never use the subroutine for anything, but Access doesn't know that. Thus, the controls always keep the name that I gave them.

  3. #3
    EHittner is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2009
    Posts
    32
    I wish that were the case but, I've checked the control name and it didn't change with the copy. I've even tried re-recreating a fresh field with a new control name and it still doesn't want to count. Not sure what to do.

  4. #4
    EHittner is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2009
    Posts
    32
    I figured it out. Had a formula in another field in the same section that was throwing it off.

    Thanks Dal Jeanis for the help. As always, I did learn something new in the course of correction.

  5. #5
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    cool. Please mark thread solved. top of page, under "thread tools".

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 04-06-2013, 10:04 AM
  2. getting a #error from count(iif( formula
    By vickan240sx in forum Access
    Replies: 1
    Last Post: 09-21-2012, 08:34 PM
  3. Replies: 3
    Last Post: 08-03-2012, 02:37 AM
  4. Count formula in Report
    By Amber in forum Reports
    Replies: 2
    Last Post: 01-30-2012, 08:22 PM
  5. Result of Count Query not known elsewhere
    By Carole in forum Access
    Replies: 1
    Last Post: 09-07-2008, 09:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums