Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 33
  1. #16
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, but I thought that you were telling me that my variable names were not meaningful. I thought this would help.

    By the way must the value on the left hand side be written as :

    txtTotalLabor



    wouldn't

    TotalLabor



    do it just as well.


    Respectfully,


    Lou_Reed

  2. #17
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Not if the textbox name is txtTotalLabor and is not bound to a field. If there is a field named TotalLabor then yes, code can use that.

    Names like Text193, Text194, Text195 for textboxes are not meaningful. JobPrice1, JobPrice2, etc are interpretable names.
    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.

  3. #18
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, but it must be txtTotalLabor, TotalLabor?

    Respectfully,

    Lou_Reed

  4. #19
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Why must it be txtTotalLabor or TotalLabor? Use whatever names you want.

    Does make me wonder why you use name of TotalLabor for the sum of fields called JobPriceX. Are the JobPriceX fields all for labor cost?
    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.

  5. #20
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Yes, but the calc formula does not have meaningful variable names and sometimes one must do a calculation like:

    -CLng(CCur(Nz(txtTotalParts])+CCur(Nz([txtTotalLabor]))*CDbl(Nz(TaxRate]))*100/100

    and in case like this it is better to use

    txtTotalLabor

    instead of

    Nz([JobPrice1])+Nz([JobPrice2])+Nz([JobPrice3])+Nz([JobPrice4])+Nz([JobPrice5]


    which would result in a some very awkward calcs if the second option were used. in fact in the tutorial we are discussing that is what they do.

    Respectfully,

    Lou_Reed

  6. #21
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Well, this tutorial is using a non-normalized data structure. A normalized db would not have a calc like Nz([JobPrice1])+Nz([JobPrice2])+Nz([JobPrice3])+Nz([JobPrice4])+Nz([JobPrice5])

    So, again, use whatever names you feel appropriate when you build a db.
    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.

  7. #22
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, when I used :


    =Nz([JobPrice1])+Nz([JobPrice2])+Nz([JobPrice3])+Nz([JobPrice4])+Nz([JobPrice5]

    Everything worked fine. Now when I use

    Nz([txtTotalLabor])=Nz([JobPrice1])+Nz([JobPrice2])+Nz([JobPrice3])+Nz([JobPrice4])+Nz([JobPrice5]


    I get the upper left corner of the text box green symbol - it is wrong.


    If I use

    TotalLabor=Nz([JobPrice1])+Nz([JobPrice2])+Nz([JobPrice3])+Nz([JobPrice4])+Nz([JobPrice5]

    it is again wrong. The upper green symbol in the text box. So I tried

    txtTotalLabor=Nz([JobPrice1])+Nz([JobPrice2])+Nz([JobPrice3])+Nz([JobPrice4])+Nz([JobPrice5]

    and that is wrong with the same symbol in the upper left hand corner of the text box.

    So I am unsure where to go now. It seems if I put anything on the left hand side of the equals
    sign it is wrong. That cannot be. In the case I must calculate

    txtTotalLabor


    because I use it in a following calculation. So what is the right symbol to put on the left
    hand side of the equals sign. I must be doing something wrong - but what?

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou_Reed

  8. #23
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Can't have anything on the left side in a textbox ControlSource expression. That would be done in VBA code to save the right side into a field.

    Again, don't recommend saving this calculated value. Do the calc when needed.

    Do that calc in a textbox named tbxTotalLabor.

    Then use tbxTotalLabor in other calcs, like:

    =tbxTotalLabor + tbxTotalParts
    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.

  9. #24
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Yes, I am putting txtTotalLabor on the left hand side of the equation. That is just to create something simple that I can use in subsequent formulas.
    I agree that is wrong. In all cases it is wrong as shown above. So what do I do if I must calculate txtTotalLabor because I need to use it in a subsequent calc?

    I hope there is a better way than Visual Basic.


    Respectfully,

    Lou_Reed

  10. #25
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I edited my previous post. Review again.
    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. #26
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, but to address your second to the last post, in the tutorial, they calculate,

    txtTotalParts and txtTotalLabor, not tbxTotalParts and tbxTotalLabor.

    So how do I get txtTotalParts instead of tbxTotalParts. I think the former is what I want txt, not tbx.


    Respectfully,


    Lou_Reed

  12. #27
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Okay, so they use txt instead of tbx, so be it. Name the textboxes with their names or use your names.

    Whatever the names are, use those in subsequent calcs in other textboxes.

    I don't understand the issue.
    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. #28
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I do not understand. Please understand that I have no MS Access manual. You say that if I want to use txt... instead of tbx..., then name the textboxes that way.

    I am guessing this is done in the properties sheet.


    Thanks in advance.


    Respectfully,


    Lou_Reed

  14. #29
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Yes, the Name property on properties sheet.
    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.

  15. #30
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay continuing on this tutorial on the final form. The jobs performed tab opens up all the labor that was done to the car. There maybe five lines for entries, but there is only two entries input. So the last three lines are empty. But they do not say zero! Should they say zero or should they just remain blank?

    Any help appreciated. Thanks in advance.

    Respectfully,


    Lou_Reed

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Form opens in wrong view
    By gar in forum Forms
    Replies: 3
    Last Post: 07-10-2015, 12:47 AM
  2. Calucation of Months between 2 records...
    By tanyalee123 in forum Queries
    Replies: 5
    Last Post: 05-09-2014, 02:45 PM
  3. Form dislays wrong record.
    By Quercus in forum Forms
    Replies: 9
    Last Post: 02-15-2014, 07:19 PM
  4. Can not refresh a form - what am I doing wrong?
    By RedGoneWILD in forum Forms
    Replies: 9
    Last Post: 06-26-2012, 04:53 PM
  5. Form with Subreport Displaying Wrong
    By claysea in forum Forms
    Replies: 3
    Last Post: 02-14-2012, 03:25 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