Results 1 to 9 of 9
  1. #1
    UTLee is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    73

    DLOOKUP Help

    I have very minimal experience with Access and desperately need some help.

    I have a query in Access called qryCashBalances that, among other things, displays certain client info: accountID (basically the account number), billToAccount (one the client’s accounts which our fees are pulled from), and cashbalance (the current cash in every account). If a client has multiple accounts we generally will only pull fees from one of our clients accounts to make it easier for our billing process. I would like to add a new field in the qryCashBalances query that pulls data from a different query, qryFeeCalc. qryFeeCalc shows the client’s aggregated fee amount (SumOfFee field) and also displays the billToAccount field mentioned earlier. I want to enter the DLOOKUP expression as a field on the CashBalances query to grab each accountID from this query, look at qryFeeCalc to see if there is a matching billToAccount, then display the SumOfFee amount associated with that billToAccount on the same row so that now I can see accountID, billToAccount, cashbalance, and the new field SumOfFee. If an account number isn’t found, I’d like it to display 0. I can’t figure out how to specify the criteria in the expression. Here’s what I’ve got so far entered into qryCashBalances:

    DLOOKUP(“SumOfFee”,”qryFeeCalc”, _________)

    Sorry for the somewhat lengthy and confusing description. Thanks in advance.
    -Lee

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It would be far more efficient to join the second query to the first on the account field. Editing the join will handle the instances where there's no record in the second query.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    UTLee is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    73
    Thanks for your quick response Paul. So, do you mean for me to open the first query and add the second query within it?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Yes, add the query to the top section and the field from it below.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    UTLee is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    73
    Did that but it is showing me the individual fee for every single account now. the point of the second query was to aggregate all fees on a per client basis rather than showing fees for each account. Then the aggregated fee should be pulled from the billToAccount.

  6. #6
    UTLee is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    73
    Just for reference, the first query shows roughly 1100 accounts and the second query only shows about 500 because we usually only bill 1 account for each client.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you post the db here? Done correctly, you should get the same data you got with the first query, plus the aggregated data from the second on those records with a matching account.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    UTLee is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    73
    Paul, sorry for the delayed response. I finally figured it out thanks to your advice. I added the second query like you mentioned, changed which fields were linked between the two, and changed the join to the second option under the Join Properties. Thanks again for your help, I'm sure I'll be back with more questions in the near future!

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help Lee!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Help with Dlookup
    By taimysho0 in forum Programming
    Replies: 2
    Last Post: 07-07-2012, 03:55 AM
  2. Dlookup
    By Wombat in forum Forms
    Replies: 2
    Last Post: 03-03-2012, 07:21 PM
  3. Is DLookUp What I should be using?
    By cameronaziz in forum Forms
    Replies: 2
    Last Post: 03-24-2011, 04:29 PM
  4. dlookup help
    By gsantacruz in forum Programming
    Replies: 9
    Last Post: 10-11-2010, 11:46 AM
  5. Need help with dlookup.
    By Keith in forum Database Design
    Replies: 8
    Last Post: 05-24-2010, 06:28 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