Solved

DSum question

Posted on 2012-04-12
3
307 Views
Last Modified: 2012-04-12
Can someone tell me what is wrong with this?

me.txtPrint =DSum("[Qty]","tblSalesOrdTranx","[DateEntered] between me.txtStart and me.txtEnd)

--Steve
0
Comment
Question by:SteveL13
3 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 37838522
Steve,

me.txtPrint =DSum("[Qty]","tblSalesOrdTranx","[DateEntered] between #" & me.txtStart & "# AND #" & me.txtEnd & "#")
0
 
LVL 31

Expert Comment

by:Helen_Feddema
ID: 37838680
It is a good idea to check for valid dates in the controls, and (if they contain valid dates) save the values to Date variables, for use in the expression.  Here is some sample code:

   If IsDate(Me![txtDate].Value) = True Then
      dteSingle = CDate(Me![txtDate].Value)
   End If

Open in new window

0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37838780
<No Points wanted>

Does this work?
=DSum("[Qty]","tblSalesOrdTranx")
if not STOP and fix it...then proceed.
Does this work:
DSum("[Qty]","tblSalesOrdTranx","[DateEntered] =" & me.txtStart )
If not then STOP and fix it...then proceed.
Does this work:
DSum("[Qty]","tblSalesOrdTranx","[DateEntered]=" & 3/15/2012 )

..ect

In other words your formula should not have gotten that complex ("Between") before you discovered something was wrong...

Most syntax errors are easy to spot (as your was), ...However, it is interesting that you did not post what *You* tried first to resolve this...
   ("Experts, I tried this, this and that, and some other thing, and none of them worked"
;-)
Sound fair?

JeffCoachman
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question