Results 1 to 4 of 4
  1. #1
    simon123 is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    12

    Using DLOOKUP fields in calculations


    Hi there,

    I have an issue with using what should hopefully be straightforward calculations. I want to work out the profit on something but I am struggling when a field with a DLOOKUP is introduced into the calculation.

    E.g. in the pic below, I just want to work out the total cost of a session, but taking the session cost minus the rebate plus any additional costs. The additional costs field is based on a DLOOKUP which pulls a total from a query, and it works great if I have added extra costs but if there no extra costs, the calculation doesn't work. If the Additional Costs field (txtTotalCosts) is empty, I just want the calculation to treat it as a zero or ignore it. I know more Excel than Access, so I have tied things like =IIF(DLookUp("SumOfAddCostValue","qryTotalAddition alCostsPerEnquiry","[Enquiry ID]=" & [Enquiry ID])="",[SessionFee]-[Rebate],=[SessionFee]-[Rebate]+[txtTotalCosts]) but that doesn't work.

    It's the same with the Gross Profit field. It can only calculate if there is data in the Total fees and total rate fields. I just need to treat them as zero if they are blank

    Does anyone have any ideas?

    Thanks very much

    Simon

    Click image for larger version. 

Name:	Picture2.jpg 
Views:	19 
Size:	49.8 KB 
ID:	34879

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654

  3. #3
    simon123 is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    12
    Ahhh that's brilliant, thank you. Now I have learned a new function.

    Works great, cheers!

  4. #4
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Happy to help. Good luck with your project.

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

Similar Threads

  1. Replies: 30
    Last Post: 09-30-2015, 10:58 AM
  2. How to Tackle Numerous Fields for Calculations?
    By Heatshiver in forum Access
    Replies: 4
    Last Post: 03-16-2012, 07:17 PM
  3. Replies: 9
    Last Post: 10-29-2011, 12:47 PM
  4. Replies: 1
    Last Post: 05-30-2011, 06:03 PM
  5. Replies: 4
    Last Post: 03-27-2011, 01:24 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