Results 1 to 3 of 3
  1. #1
    ICBSprod's Avatar
    ICBSprod is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Jan 2014
    Location
    Norway
    Posts
    10

    Dsum filtering

    Hello!



    I use a control containing the following DSum function in my form: (Norwegian character set)

    =DSum("[Sum]";"QueryArbeidsdetaljer";"[ArbeidsavtaleID]=Forms!Arbeidsavtale!ArbeidsavtaleID")

    Here my main form is "Arbeidsavtale" and my subform is "QueryArbeidsdetaljer"

    In the subform I have a field named "Oppgaveområde"
    Now I want to add a new control containing a Dsum fiunction on my form as above, but this time I only want it to sum the records from "Oppgaveområde" that contains the text "Kulturskole"
    I guess I have to put in "Like Kulturskole" somewhere, but I have not any clue how to do it and where to put it.
    Likewise I want a third control with a Dsum function that sums everything but "Kulturskole".
    You may also take a look at the image I have attatched.
    Can anyone help me?


    Regards
    Børge
    Norway
    Attached Thumbnails Attached Thumbnails Form.GIF  

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Something like this should work.

    "[ArbeidsavtaleID]=Forms!Arbeidsavtale!ArbeidsavtaleID AND [Oppgaveområde] Like '"Kulturskole"'"

    "[ArbeidsavtaleID]=Forms!Arbeidsavtale!ArbeidsavtaleID AND [Oppgaveområde] Not Like '"Kulturskole"'"

    Remember that each Dsum(), Domain function, is taking a trip to the data to do your calculation. You may experience better performance grabbing a RecordsetClone of your subform and using the RecordsetClone to do the math. This alternative method requires some VBA code.

  3. #3
    ICBSprod's Avatar
    ICBSprod is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Jan 2014
    Location
    Norway
    Posts
    10
    Exellent!
    Thank You very much!
    I think I will take a closer look at the RecordsetClone, but for now, I am happy.
    Thanks!

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

Similar Threads

  1. DSUM with DLOOKUP
    By maxmaggot in forum Forms
    Replies: 1
    Last Post: 03-31-2013, 04:48 PM
  2. Dsum Help?
    By Ragin_roider in forum Queries
    Replies: 5
    Last Post: 03-19-2012, 03:10 PM
  3. Help with Sum and DSum
    By objNoob in forum Reports
    Replies: 5
    Last Post: 12-05-2011, 01:55 AM
  4. How do I use the DSum
    By Ironclaw in forum Access
    Replies: 1
    Last Post: 08-25-2010, 07:35 AM
  5. Help with dsum
    By bjsbrown in forum Reports
    Replies: 6
    Last Post: 02-06-2010, 09:33 AM

Tags for this Thread

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