Results 1 to 5 of 5
  1. #1
    frdnwr is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    8

    simple dsum function but I can't get it to work

    Hello all ,


    In the attached file, there is my sales table, and the form that I'd like to use as a report ..
    I want to add a dsum in each control source .. that gets the sum of cash or quantities sold, based on the date range, and other criteria

    I can't get the dsum to work with date range, it always returns #error

    here is the syntax I'm using : =DSum("[total]","sales","[datein]=#"& forms![dailyreport]![startdate]&"#")
    I am trying this after I tried the syntax for a range ..

    any clue??



    ps: I tried making both ends of the criteria a short-date, I tried making the row source of the start date field values from " select distinct ... " query
    I still get #error
    Attached Files Attached Files
    Last edited by frdnwr; 05-21-2014 at 12:08 PM. Reason: adding some more data

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    If forms![dailyreport]![startdate] has no date in the text box you'll get an error.

    MAKE SURE there is a value. If this happens at ON LOAD event, it could resolve before the txt box gets a value.

  3. #3
    frdnwr is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2013
    Posts
    8
    I did ...

    I still get the #error ...

  4. #4
    frdnwr is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2013
    Posts
    8
    so, what else may cause this error?
    or how can I use an alternative method .. a query maybe

  5. #5
    frdnwr is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2013
    Posts
    8
    I added the code to a button, to set the control source of each field to the dsum function of the related sum .. and it worked fine.

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

Similar Threads

  1. Dsum Function
    By LOIZOS in forum Forms
    Replies: 10
    Last Post: 03-20-2014, 10:05 AM
  2. DSum Function
    By azhar2006 in forum Forms
    Replies: 7
    Last Post: 12-08-2013, 05:07 PM
  3. Dsum() Function
    By rkalapura in forum Queries
    Replies: 2
    Last Post: 10-24-2012, 05:58 PM
  4. Dsum() function
    By rkalapura in forum Forms
    Replies: 3
    Last Post: 10-10-2012, 10:06 PM
  5. Problem in Query and DSUM function
    By simplefahad2005 in forum Access
    Replies: 3
    Last Post: 07-27-2012, 12:46 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