Results 1 to 5 of 5
  1. #1
    krutoigoga is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2010
    Posts
    20

    Question DSUM with date criteria from form

    Hello people.
    Need help with a dsum code and date criteria.

    The following code is used to display the "sum" of a field from a table.


    Code:
    =DSum("[Front]","Tracking","[DATES] Between #" & [Forms]![Search]![Text0] & "# And #" & [Forms]![Search]![Text2] & "#")
    It shows the sum .. as requested, but it seems to ignore the date criteria (entered in text0 and text2). So if the sum of the field is 20 for the past 3 months, 5 of them in July - I search between July 1 and July 25th >> the result is 20, not 5. Make sense?

    Table name: Tracking
    Column (field) name: Front
    Date Field name: Dates
    Form name (used to enter dates): Search

    PLEASE HELP!
    Thanks.

  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
    How are you entering the date? If you're using a non-US date format, it will interpret

    1/7/10

    as January 7, not July 1.

    http://support.microsoft.com/default...b;en-us;210069
    http://www.mvps.org/access/datetime/date0005.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    krutoigoga is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2010
    Posts
    20
    Quote Originally Posted by pbaldy View Post
    How are you entering the date? If you're using a non-US date format, it will interpret

    1/7/10

    as January 7, not July 1.

    http://support.microsoft.com/default...b;en-us;210069
    http://www.mvps.org/access/datetime/date0005.htm

    I am using 28/07/2010 (dd/mm/yyyy) a.e. the format for the date is set to "Medium Date" in the form. I require admin access to make changes in the regional settings (control panel).
    From what I understood the format has to be mm/dd/yyyy?
    I removed the Medium Date format from the form and the table. I tried search by the dates in mm/dd/yyyy, mm dd, mm dd yy, mm-dd-yy formats and the report still does not show the proper numbers.
    Any ideas?

  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
    Did you try either of the methods in the links I posted? I've used the second in applications for UK clients with no problems.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    krutoigoga is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2010
    Posts
    20
    Quote Originally Posted by pbaldy View Post
    Did you try either of the methods in the links I posted? I've used the second in applications for UK clients with no problems.
    Could not try the first link as I do not have admin access and I just don;t know where to add the code provided in the 2nd link.
    I'm jusing VB code (provided by access forums) for the commnad button but thats as far as my limited knowledge goes.

    Code:
    Private Sub Command4_Click()
    On Error GoTo Err_Command4_Click
        Dim stDocName As String
        stDocName = "Tracking Report"
        DoCmd.OpenReport stDocName, acPreview
    Exit_Command4_Click:
        Exit Sub
    Err_Command4_Click:
        MsgBox Err.Description
        Resume Exit_Command4_Click
        
    End Sub

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

Similar Threads

  1. Query Date Criteria
    By svanicek in forum Access
    Replies: 1
    Last Post: 07-09-2010, 11:13 AM
  2. Date/Time Criteria
    By KWarzala in forum Queries
    Replies: 3
    Last Post: 06-04-2010, 07:08 PM
  3. Replies: 1
    Last Post: 05-05-2010, 01:54 AM
  4. Query criteria, add 5 months to date
    By thart21 in forum Queries
    Replies: 1
    Last Post: 03-29-2010, 05:09 PM
  5. Date Criteria
    By tcollins02 in forum Queries
    Replies: 1
    Last Post: 09-09-2008, 08:27 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