Results 1 to 9 of 9
  1. #1
    kolsen is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2016
    Posts
    13

    #Name? Error on main form with calculated value from subform footer

    I have a main form with a subform
    Main form called Tracker, with a subform called TrainingSubForm.


    The footer of TrainingSubform has a calculated field [Total Hours] (a sum) which calculates nicely and displays in the subform footer when I view the subform.

    On the main form the embedded subform does not display it's footer as it is displayed as a datasheet. (not sure if this is the issue.
    I wanted to display that calculated field on the main form but I get #Name? error when I set up a field with control source =[Forms]![TrainingSubForm]![Total Hours]

    Kimberly

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Maybe try something like ...

    =[Forms]![MainFormName]![TrainingSubForm].[Form].[Total Hours]

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I always refer to an archived file, when doing this, or else I get tangled up, and it states that the syntax would be

    =TrainingSubForm.Form![Total Hours]

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    You can't refer to a subform using Forms![TrainingSubForm]![Total Hours], because subforms are not a part of the Forms! collection.

    Instead, you use the name of the control on the main form that contains the subform. Your reference to the subform and its control will look like this:

    =[controlname].form![total Hours], where controlname is the name of the control on you main form.

    It is important to note that the subform is not referred to by its name (in your case TrainingSubForm)

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Unless the names of the Subform Control and the Subform, itself, are one and the same...which is why it's probably a good idea to give the Subform Control a name different from the Access assigned name, which is the same!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    kolsen is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2016
    Posts
    13
    Quote Originally Posted by Missinglinq View Post
    Unless the names of the Subform Control and the Subform, itself, are one and the same...which is why it's probably a good idea to give the Subform Control a name different from the Access assigned name, which is the same!

    Linq ;0)>
    Thanks. I am out of the office for a few days but will give that a try on my return. There is so much incorrect information about this online

  7. #7
    kolsen is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2016
    Posts
    13
    Worked well thanks

  8. #8
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Glad we could help!

    Good luck with your project!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  9. #9
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

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

Similar Threads

  1. Replies: 1
    Last Post: 07-10-2015, 06:38 PM
  2. Replies: 8
    Last Post: 04-29-2013, 12:11 PM
  3. Replies: 8
    Last Post: 03-13-2013, 08:32 AM
  4. Syntax Error For Main Form Subform Report
    By burrina in forum Reports
    Replies: 1
    Last Post: 12-27-2012, 03:03 AM
  5. Replies: 4
    Last Post: 05-17-2010, 05:32 PM

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