• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 295
  • Last Modified:

DSum with multiple criteria

On the after update event of a combox box I want a field to populate with a number from the following code.  But something is wrong with it.  Can anyone help?  Here it is...

Me.txtQtyFGtoDate = DSum("[Qty]", "tblTransactions", "[JobN] = me.txtJobN" And "[PartN] = me.partN" And [Type] = "FG")
0
SteveL13
Asked:
SteveL13
1 Solution
 
jppintoCommented:
Instead of this:

Me.txtQtyFGtoDate = DSum("[Qty]", "tblTransactions", "[JobN] = me.txtJobN" And "[PartN] = me.partN" And [Type] = "FG")

Try like this:

Me.txtQtyFGtoDate = DSum("[Qty]", "tblTransactions", "[JobN] = me.txtJobN" And "[PartN] = me.partN" And "[Type] = FG")

jppinto
0
 
Rey Obrero (Capricorn1)Commented:

if  JobN is Number and PArtN is number

Me.txtQtyFGtoDate = DSum("[Qty]", "tblTransactions", "[JobN] =" & me.txtJobN & " And [PartN] = " & me.partN & " And [Type] = 'FG'")

if they are text datatype

use this

Me.txtQtyFGtoDate = DSum("[Qty]", "tblTransactions", "[JobN] ='" & me.txtJobN & "' And [PartN] = '" & me.partN & "' And [Type] = 'FG'")
0
 
SteveL13Author Commented:
Note:  JobN and PartN and Type are text fields.
0
 
NorieData ProcessorCommented:
If you are trying to include values from the form.

Me.txtQtyFGtoDate = DSum("[Qty]", "tblTransactions", "[JobN] =" & Me.txtJobN & " And [PartN] = " & Me.partN & " And [Type] = 'FG'")
0
 
Rey Obrero (Capricorn1)Commented:
use the second Dsum i posted above
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now