Solved

DSum question

Posted on 2012-04-12
3
299 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Direct Mail software 4 44
ms access 2013, running .mdb 2 31
Update fields from multiple tables via same form 2 25
Excess tables to Excel BackUp 3 29
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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 …

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now