Solved

Another syntax issue

Posted on 2014-11-28
5
94 Views
Last Modified: 2014-11-29
What is wrong with:

(DSum("[QTY_ORDERED]","tblInventory","[PART_NO] = '" & [Forms]![frmParts]![txtPART_NO] & "' AND [TRNX_TYPE] ="ORD"")
0
Comment
Question by:SteveL13
  • 2
  • 2
5 Comments
 
LVL 22

Expert Comment

by:Flyster
ID: 40471071
See if this works:

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

Flyster
0
 
LVL 18

Accepted Solution

by:
Simon earned 500 total points
ID: 40471073
The initial "(" before DSUM and I think you want single quotes around string value 'ORD'

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

Author Closing Comment

by:SteveL13
ID: 40471088
That one worked.  Thank you!
0
 
LVL 18

Expert Comment

by:Simon
ID: 40471105
You're welcome. I remember struggling when I first built these domain aggregate functions, especially when inserting control values like [Forms]![frmParts]![txtPART_NO] into the formula. I find it helps to temporarily replace them with a hard-coded value because it simplifies the testing and makes the formula easier to examine for balance (open/close brackets, paired single & double quotes).
=DSum("[QTY_ORDERED]","tblInventory","[PART_NO] = '" & [Forms]![frmParts]![txtPART_NO] & "' AND [TRNX_TYPE] ="ORD"") 
v
=DSum("[QTY_ORDERED]","tblInventory","[PART_NO] = '55' AND [TRNX_TYPE] ='ORD' ") 

Open in new window

Notice that when you take the reference to the control out you can also take out the surrounding & and " from either side, so it makes quite a difference to the length of the formula.
Also worth spacing out the single and double quotes where possible to improve readability.
0
 

Author Comment

by:SteveL13
ID: 40471606
Simon,

Yes, the single and double quotes really confuse me.  

--Steve
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

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

13 Experts available now in Live!

Get 1:1 Help Now