Results 1 to 8 of 8
  1. #1
    dniezby is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2013
    Posts
    183

    Dsum issue.

    I have a transaction table that tracks all of my member's transactions. Sort of like Airline miles; if someone spends X they get XX in points.


    On my member form, I want those points to show up as "current points".

    I created a textbox on my form with
    =DSum([player_points],[plr_transactions],[member_id]=[member_id])

    It just gives me a #Name?

    Any thoughts?

  2. #2
    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
    Try:

    =DSum("[player_points]", "[plr_transactions]", "[member_id]=" & [member_id])

    Might review Access Help on use of domain aggregate functions.
    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. #3
    dniezby is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2013
    Posts
    183
    The quotes worked but it doesn't work for each record. When I load the first record, it loads and it correct, but then when I go to the next one, it's the same. Do I have to related it or something?

  4. #4
    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
    No, that should work. The textbox is in Detail section of form?
    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. #5
    dniezby is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2013
    Posts
    183
    It is in the details section of the form. I agree, it should work.
    Here is the application if anyone wants to take a look.
    http://sdrv.ms/12lglP1

    It's supposed to show me a running total of all the player's transaction (player_points) from the transaction table. It does show me the correct points but ONLY for the one player. When I move to a new record, it doesn't update for the new player.

  6. #6
    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
    The sum shown is the total of the entire table.

    The field name in plr_transactions is member not member_ID

    You have a lookup set for the member field in plr_transactions. (I NEVER set lookups in tables, review: http://access.mvps.org/access/lookupfields.htm)

    The actual value in the member field is the autonumber primary key from members table.

    =DSum("player_points","plr_transactions","member=" & [ID_memtbl])
    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. #7
    dniezby is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2013
    Posts
    183
    Hmm, I did write it like this once and it didn't work. For some reason, when I wrote it, it put everything in brackets when I saved the formula. It didn't do it this time. I kind of figured I was mixing one of the fields. I think the last time I tried it this way, I had member and ID_memtble reversed. When I was reading up on the DSum function I didn't understand the way they described it. Now that I see it in use, I do. Thank you again.

    Also, I read the information in your link. If you don't use lookups, how do YOU do it. For example, I need to look up member IDs a lot in my app. What would you do differently for all the times I set a look up?

  8. #8
    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
    Set lookups in comboboxes on forms, never in tables. I avoid lookup alias whenever I can. In other words, I will save the descriptive text instead of ID. For instance, for the states info I would make the 2-letter state abbreviation the key and eliminate the autonumber ID. I might even make member_ID the primary key instead of ID_memtbl. The way I set up most of my projects I don't use autonumber PK. There are arguments on both sides. Right now I am dealing with an issue of merging data from several Access files that use autonumber PK/FK. Requires complicated VBA code to handle.
    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.

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

Similar Threads

  1. Dsum Help?
    By Ragin_roider in forum Queries
    Replies: 5
    Last Post: 03-19-2012, 03:10 PM
  2. Help with Sum and DSum
    By objNoob in forum Reports
    Replies: 5
    Last Post: 12-05-2011, 01:55 AM
  3. How do I use the DSum
    By Ironclaw in forum Access
    Replies: 1
    Last Post: 08-25-2010, 07:35 AM
  4. Dsum causing speed issue
    By ethoemmes in forum Queries
    Replies: 0
    Last Post: 07-06-2010, 05:22 AM
  5. Help with dsum
    By bjsbrown in forum Reports
    Replies: 6
    Last Post: 02-06-2010, 09:33 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