Solved

Revise DSum syntax

Posted on 2014-11-24
3
160 Views
Last Modified: 2014-11-24
I have the following DSum syntax for the control source of a field on a form.  But I need to change it,  Here is the current code:

=DSum("[QTY_ORDERED]","tblInventory","[PART_NO] = '" & [Forms]![frmParts]![txtPART_NO] & "'")

But I need to add two qualifiers to it.

Where TRNX_TYPE = "I" or "O"
How can I change this control source?

I tried:

=DSum("[QTY_ORDERED]","tblInventory","[PART_NO] = '" & [Forms]![frmParts]![txtPART_NO] & "'" WHERE [TRNX_TYPE] = "I" or "O")

but it isn't right.
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 37

Assisted Solution

by:PatHartman
PatHartman earned 250 total points
ID: 40463049
=DSum("[QTY_ORDERED]","tblInventory","[PART_NO] = '" & [Forms]![frmParts]![txtPART_NO] & "'" WHERE [TRNX_TYPE] = "I" or [TRNX_TYPE] = "O")

You have to repeat the operand.
0
 
LVL 50

Accepted Solution

by:
Gustav Brock earned 250 total points
ID: 40463216
It's also your (missing) single/double quotes:

=DSum("[QTY_ORDERED]","tblInventory","[PART_NO] = '" & [Forms]![frmParts]![txtPART_NO] & "' And [TRNX_TYPE] = 'I' or [TRNX_TYPE] = 'O'")

/gustav
0
 

Author Closing Comment

by:SteveL13
ID: 40463224
Thank you to both of you.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

690 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