Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    145

    #Name? error on a form


    I am trying to sum the values of 2 fields on a form The form is based on a table and no field on a form, report or table has the same name. When I add the field initially it calculates correctly. However if I close the form or database and reopen it the #Name? error appears. I can't figure out what is wrong. DB attached. Any help is appreciated
    Attached Files Attached Files

  2. #2
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    However if I close the form or database and reopen it the #Name? error appears.
    Not much information provided to see the problem. There is no value in the form or subform that shows #Name? in the DB provided. Where do we start?

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Is it this?
    =[BreakMainCalFrm]+[BreakProtCalFrm]

    Why on earth is ItemMeasure so wide, which means you hav eto scroll the form?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    145
    Davegri,

    The error is on the form DataEntryMeals. The Text box with the error is right under the word Breakfast

  5. #5
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    145
    Welshgasman, That is the calulation that is throwing the error. Sorry, I do not know what you mean by ItemMeasure. I don't see any need to scroll the form. All controls on the form are easily visible.

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Well I was looking at it on a 17" laptop and the control itemmeasure was very wide for the data it held.That caused the controls to the right to not be visible unless scrolling.
    That formula displayed a number for me?
    If you did not upload the real db, make sure those controls are not null.
    On a tablet ATM, will post pic tomorrow.

  7. #7
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    145
    That is the real DB. The controls I am trying to sum all have a value or zero. As I mentioned before when I create the control to sum the values it works correctly. When I close the DB and open it again the #Name? error appears and does not change. Could it be some Access setting? Are the field names too long or too similar?

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    works for me, unable to replicate the error

  9. #9
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    As I mentioned before when I create the control to sum the values it works correctly.
    Do you mean in design view when you create the control (add the textbox to the form) it works correctly?

    The DB you submitted works fine for me. No errors. Shows proper value for all 209 records. Open form, close form, all works fine.
    I deleted and re-created the text box and it also works fine. Closed DB, reopened; works fine.

    I simply do not see the error you are experiencing.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Resize columns in datasheet subform so don't have to scroll. Don't need to show ID field. What is purpose of this subform?

    I also do not see #Name? error in that textbox. All records show calculated value.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    145
    I've added a screenshot of what I see when I open the form. The subform is so I know the value of an item if I want to list it in either the Snack, Dessert, Additions or Other Protein fields. I can resize the subform but does that have anything to do with my #Name? error?
    Attached Thumbnails Attached Thumbnails Screenshot 2024-07-04 173406.png  

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Size of form has nothing to do with that error. Error means Access cannot find referenced control.

    Suggest deleting textbox and recreating.

    Still weird that we do not see error.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    145
    Yes it is very weird that I'm the only one who see it. I've deleted and recreated the textbox several times sand the same error occurs after I close and reopen the database. Something else that is off is that I had several text boxes that summed values from other text boxes and they worked as designed since I created the DB in November '23. Just the other day I opened the DB and saw numerous #Name? errors. I deleted them all and have been working just to get one to work properly. The only thing that I changed was that I added a calculated field in the AllMeals table. The calculated field is not part of any sum calulation.

  14. #14
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    Let's try to get the result in a different way. Maybe it will shed light on why the current method fails, or if it works, go with it.
    Rename the text box, and remove the control source so the textbox is unbound.
    Add a form_current event to put the sum in the textbox.
    Click image for larger version. 

Name:	Rename.png 
Views:	24 
Size:	39.5 KB 
ID:	51948

    Code:
    Private Sub Form_Current()
        Me.BreakTotCalFrm = Me.BreakMainCalFrm + Me.BreakProtCalFrm
    End Sub

  15. #15
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Just so you know we are telling the truth. I get a value on all the records I went back through?
    Click image for larger version. 

Name:	Food.jpg 
Views:	22 
Size:	138.4 KB 
ID:	51949
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 13
    Last Post: 08-06-2022, 05:11 PM
  2. Replies: 7
    Last Post: 10-27-2021, 08:42 AM
  3. Replies: 6
    Last Post: 03-17-2016, 02:10 PM
  4. Replies: 14
    Last Post: 03-31-2015, 05:20 PM
  5. Replies: 1
    Last Post: 11-18-2014, 12:35 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