Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

DSum question

Can someone tell me what is wrong with this?

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

--Steve
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

<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