#1
  1. No Profile Picture
    Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Oct 2007
    Posts
    160
    Rep Power
    22

    Criteria when using DSum function


    Using the DSum function, the criteria section should compare a date . I have written it using inverted commas as I would for text datatypes, but it doesn't work. I've also tried using # signs. Can anyone help in amending the criteria (final) section :

    TotalClaimsThisYear = DSum("NumberOfClaims", "qryRunningTotalClaims", "DateActioned > """ & Me.CompanyStartDate"""" )

    A further question: can you have two criteria in one DSum function? Appreciate any help - thanks.
  2. #2
  3. Contributing User
    ASP Adventurer (500 - 999 posts)

    Join Date
    Jun 2011
    Location
    South Jersey
    Posts
    544
    Rep Power
    59
    TotalClaimsThisYear = DSum("NumberOfClaims", "qryRunningTotalClaims", "DateActioned > #" & Me.CompanyStartDate & "#" )

    You can use more than one criteria:

    TotalClaimsThisYear = DSum("NumberOfClaims", "qryRunningTotalClaims", "DateActioned > #" & Me.CompanyStartDate & "# and [SecondFieldName] = '" & me.Somerandomtextfield & "'" )

Similar Threads

  1. Using UK date format in dsum criteria
    By bobsmith in forum Microsoft Access Help
    Replies: 4
    Last Post: August 31st, 2011, 05:14 AM
  2. Help with the Dsum function needed
    By coolhandphil in forum Microsoft Access Help
    Replies: 1
    Last Post: September 23rd, 2010, 02:49 PM
  3. Double Criteria for a dlookup function
    By Papa G in forum Microsoft Access Help
    Replies: 3
    Last Post: April 2nd, 2010, 12:55 PM
  4. DLookup function using two combo boxes as criteria
    By SHAWTY721 in forum Microsoft Access Help
    Replies: 1
    Last Post: October 13th, 2007, 05:20 PM
  5. Dsum with Multiple Criteria
    By Thomas Lafferty in forum Microsoft Access Help
    Replies: 1
    Last Post: April 25th, 2006, 03:57 PM

IMN logo majestic logo threadwatch logo seochat tools logo