Results 1 to 12 of 12
  1. #1
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    This output is Nonsensical

    CeilInn.zip

    In my attached I have an sfOccupancies form. It give the command #NAME error on two different text boxes. I take that to mean

    that something in the textbox formula is undefined. The two in question are room use and phone use; again they are undefined.

    Now, when they are added together to get a total sum for the bill everything is defined - in that formula - and I get an answer. The answer is correct.

    But how can it the two added values be each undefined, but when added together they give a value?


    Any help appreciated.


    Respectfully,



    Lou_Reed

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Have you tried correcting the syntax in the Control Source property?

  3. #3
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    CeilInn.zip

    In the previous post I believe that I forgot to attach the CeilInn.zip file. I am doing so
    now.

    Thanks for any help in advance.


    Respectfully,

    Lou_Reed

  4. #4
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I will correct the syntax in the Control Source Property and see if that works.


    Thanks very much.


    R,

    Lou_Reed

  5. #5
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    The formulas were copied from the Ceil Inn tutorial and they are

    =[sbfOccupancies].[Form]![txtRateTotal]

    and

    =[sbfOccupancies].[Form]![txtPhoneUse]

    They are exactly what is shown in the Ceil Inn tutorial.

    I clearly am unfamiliar with the syntax so could someone explain it to me?

    For instance the first formula:

    =[sbfOccupancies].[Form]![txtRateTotal]

    Now what does each of the three pieces (sbfOccupancies. [Form], [txtRateTotal]) mean?

    Just because I copied it from the Ceil Inn tutorial does not mean it is correct. That tutorial is full
    of errors - see previous posts.

    However, I would appreciated knowing where the syntax error is.

    Respectfully,


    Lou_Reed

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Code:
    =[sbfOccupancies].[Form]![txtRateTotal]
    This is looking for a control named txtRateTotal. Oddly enough, the control is within the subform. Maybe it is a hidden control. Check that the name of the Subform Control that contains the Subform is named sbfOccupancies and there is a textbox control (within the subform) named txtRateTotal in the form where the expression is.

  7. #7
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Just for my information what does

    ].[Form]![txtRateTotal]

    mean? I am particularly referring to the ! between the two expressions. By the way I am working on the unattached subform sfOccupancies. Thus to make things work I removed the b from the expressions.

    Before:

    =[sbfOccupancies].[Form]![txtRateTotal]

    After

    =[sfOccupancies].[Form]![txtRateTotal]


    It had no effect on anything, so I guess it was not the solution.

    I am still exploring other solutions. Can you answer my question at the beginning of this post?

    Any help appreciated. Thanks in advance.

    Respectfully,


    Lou_Reed

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Can you answer my question at the beginning of this post?
    When you reference an object, Access needs to understand where that object is. The best way to do this is to use the name of an object. However, using only the name will not determine where this object is located. So, you need to use the fully qualified name. If one object is parent to another object, place the parent name in front of the child object. You can use the exclamation point to notate or separate one object from another. Similarly, you can use the dot-notation to separate the names.

    In VBA I like to use the exclamation and SQL will not understand this because it uses the dot notation to separate objects. But, when building expressions in the Query Designer (within the grid for Criteria for instance) you can use the !

    The example you provided gets a little confusing because there is an object that is pretending to be a form object.
    =[sbfOccupancies].[Form]![txtRateTotal]

    Here, sbfOccupancies is a control. But, it needs to be treated as a Form when considering the fully qualified name. So use the . operator to access the members of sbfOccupancies. Then place Form afterwards. Then, separate it with ! to name the child object.

    On a side note. You seem to have some strong opinions about this sample DB that is a tutorial. Perhaps you could do me a favor and take a look at a video tutorial I created and offer your opinion of it. It is 40 minutes long and it is about the properties of the Combo Box control. It is a screencast and I am interested to know if it is informative, good quality, easy to follow, etc. I don't think it is perfect but would like to improve upon it or future videos.

    It is available for download here. If you have the time to look at it and post your opinion about it in the thread linked here, I will appreciate it.
    https://www.accessforums.net/general...ats-52640.html

  9. #9
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I created a solution, but it was not of the kind that you suggested.

    =Sum(Nz([RateApplied],0))

    and

    =Sum(Nz([PhoneCharge],0))\


    These work. I will admit that I mostly copied them from a formula that I knew
    would work and that was also on the form and it was the formula for the Total of
    the Hotel bill or

    =Nz([txtRateTotal])+Nz([txtPhoneUse])


    Now I am guessing that the sum amount can be calculated this way, but it is probably not what
    you were looking for.

    =[sbfOccupancies].[Form]![txtRateTotal]

    which I think that you suggested that I rewrite

    =[sbfOccupancies].[txtRateTotal]![Form]


    Please give me your solution as I think it will be an improvement over mine.

    Mine works - that all I can say about it.

    I will try to look at your video this week-end.

    Respectfully,


    Lou_Reed
    Last edited by Lou_Reed; 05-28-2015 at 11:49 AM. Reason: correction

  10. #10
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    =Sum(Nz([PhoneCharge],0))\
    This should cause a syntax error. Maybe ...
    =Sum(Nz([PhoneCharge],0))

    which I think that you suggested that I rewrite

    =[sbfOccupancies].[txtRateTotal]![Form]
    I would suggest making sure the control named in the expression exists in the subform and the names are spelled correctly. This is how you can verify you have the correct syntax for your unbound control.

    Having said that, it is difficult to determine what is going on with the control named, "txtRateTotal". Perhaps you can locate that control and make sure it is Visible during runtime. This control should have the correct Value when the User interacts with the form. Not sure why the original developers decided to use one control to display the same value in, yet, another control.

    I suspect the control named txtRateTotal has an expression or is somehow connected with a formula that looks like
    =Nz([txtRateTotal])+Nz([txtPhoneUse])

  11. #11
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Yes that would cause a syntax error. This formula would

    =Sum(Nz([PhoneCharge],0))\

    but remove the back slash and it works fine on my system.


    Again I do not think this is what you were driving at in you post
    to my question.

    What is your solution?

    Respectfully,

    Lou_Reed

  12. #12
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    What is your solution?
    I would suggest making sure the control named in the expression exists in the subform and the names are spelled correctly. This is how you can verify you have the correct syntax for your unbound control.

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

Similar Threads

  1. output
    By slimjen in forum Forms
    Replies: 15
    Last Post: 08-12-2014, 02:20 PM
  2. Replies: 4
    Last Post: 04-23-2014, 04:35 PM
  3. Replies: 4
    Last Post: 12-30-2013, 05:51 PM
  4. How to query for this output?
    By seemi143 in forum Queries
    Replies: 1
    Last Post: 12-04-2013, 02:37 AM
  5. Output to pdf
    By TOMMY.MYERS668 in forum Programming
    Replies: 3
    Last Post: 02-25-2013, 11:03 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