Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26
  1. #16
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    At this point I am not trying to get creative. I am just working through the Ceil Inn tutorial to try and understand it. So I guess
    that I am using the dlookups which are what they (the Ceil Inn tutorial) are using.



    I just am trying to understand the tutorial in all its completeness. O am not experienced enough to get fancy.


    Respectfully,


    Lou_Reed

  2. #17
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I guess I will try dlookup to finish the CeilInn tutorial. it seems to be more direct and now my goal is to complete thisthing.

    I need to calculate AmountCharged. This is found using the following generic formula.

    AmmountCharged = (Number of Days spent at Ceil Inn motel)*(daily rate) + phonecharge )* TaxRate

    I need to calculate the number of days at the Ceil Inn Motel which is (check in date)*(payment date)

    Assuming the resident pays at the time of check out.

    It just seems to find these the easiest way is using dlookup and then applying the above formulas.

    Please correct me if I am wrong. I need to get feedback.

    Any help appreciated.


    Thanks in advance.


    Respectfully,


    Lou_Reed

  3. #18
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    your number of days is not a multiplication function it's a subtraction function

    payment date - check in date

    and your amount charged has incorrect parentheses.

    it should be (((Number of days spent at ceil inn)*(day rate)) + (phone charge))* tax rate if you are going to tax their phone calls as well

    other wise it should be

    (((number of days spent a ceil inn)*(day rate)) * tax rate) + phone charge

  4. #19
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Of course you are right. I did have disclaimer in that I did say "generic formula" which cover a lot of territory regarding errors. The number of days
    is not a something that you calculate using multiplication but something that you calculate using subtraction.

    I was wrong and sloppy.

    Now, I still have a question on calculating dates. How can one insure that the difference calculating Days spent at the Ceil Inn.

    is calculated in days not hours, minutes seconds, etc. I know it can be done I am just looking for an easy direct way.


    Any help appreciated.


    Thanks in advance.

    Respectfully,


    Lou_Reed

  5. #20
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    the datediff function returns, by default, a number of days. In most instance if you perform a subtraction of two date fields you will also get a number of days even without using the datediff function.

  6. #21
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    This discussion deals with The Ceil Inn tutorial shown here:

    http://www.functionx.com/access/appl...ns/ceilinn.htm

    I just noticed that AmountCharged is a part of the Payments Table and Payments Form.

    You are to put it in just like you put in tax rate of 7.75%. Except it
    is a calculated value and the formula is shown in an above posting.

    The reason that I am asking this is the only way that I know to deal with AmountCharged is to calculate it.

    You cannot just put it in a text box.

    Now where can I set the calculated value equal to AmountCharged?

    Then I can use in other tables with dlookup. It is easier and I will wager faster than recalculating
    AmountCharged charged every time it is needed in a function.


    Any help appreciated. Thanks in advance.

    Respectfully,


    Lou_Reed

  7. #22
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    I wager against that. AmountCharged should be calculated. What you might want to save is the rate as rates can be changed over time. However, for purposes of this tutorial, probably want to assume that rates never change.
    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.

  8. #23
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    How can it be faster to recalculate AmountCharged over again every time you need it? If the inputs do not change then calculate once, store value in AmountCharged and plug that in whenever you need to use AmountCharged in a calculation.


    I agree if the inputs change then the AmountCharged must be recalculated.


    Now where can I set that AmountCharged equal to the calculation? I assume that I set it equal to AmountCharged immediately after I calculate it? If I must use the calculation each time as you say, then AmountCharged must be truly a wasted variable - it itself is never actually used.

    Respectfully,


    Lou_Reed

  9. #24
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Requires code (macro or VBA) to save calculated data. The code itself is simple (Me!AmountCharged = Me.tbxAmountCharged) and the real trick is figuring out what event to put it in.

    Code behind the AfterUpdate event of each of the textboxes bound to fields used in the calc would accomplish. In your case, really is much simpler to calculate when needed and probably satisfies purposes of tutorial.
    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.

  10. #25
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, but having made a living as a programmer we always were interested in speed. Try and keep speed to a minimum. So if we had a calculation and it was repeated many times, after you do the initial calculation set it equal to variable and use that whenever that calculation is called for again.

    So I guess AmountCharged is never officially used per se, i.e. the term AmountCharged is not used. Instead use the calculation expression whenever AmountCharged is required.

    This could make for some messy expressions in the text boxes.


    Respectfully,

    Lou_Reed

  11. #26
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    I do have a db where saving results of very complex calcs (from laboratory sample testing) is beneficial - essentially the calc result becomes our 'raw' data and is reported, the real 'raw' values are not. In our older db (dBaseIV), the values used in calcs were not even retained. The db calcs are to assist lab techs so they could do less manual/calculator calcs and just the final results are saved. Your calc for AmountCharged is simple by comparison. So if you feel saving calc is justified then go for it but if you intend to report out each of the elements anyway, simpler to do calc when needed. This can often be done once in query (sometimes in table in Calculated field introduced with 2010) and then use that table/query for multiple query/form/report objects.
    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.

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

Similar Threads

  1. Replies: 11
    Last Post: 05-01-2014, 11:56 AM
  2. Replies: 3
    Last Post: 01-23-2014, 07:49 AM
  3. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  4. Replies: 6
    Last Post: 05-30-2012, 12:32 PM
  5. Replies: 1
    Last Post: 05-11-2012, 10:59 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