Solved

A new DSum question

Posted on 2012-04-12
10
214 Views
Last Modified: 2012-04-12
What is wrong with...

Me.txtFormsRkfd = DSum("[NumForms]", "tblPrintOrdTranx", "[DateEntered] between #" & Me.txtStart & "# AND #" & Me.txtEnd & "#", "[ProdPlant] = "'"CompanyName"'")

--Steve
0
Comment
Question by:SteveL13
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37839687
Again,

What did *you* try first to fix this?

Dis you follow the basic troubleshooting I outlined for you in your previous post?

You really should not just simply post your formulas and ask us to "Fix" them for you.
0
 

Author Comment

by:SteveL13
ID: 37839697
I've tried changing the single quotes and double quotes and can't resolve the issue.  The previous question today did not have the...

"[ProdPlant] = "'"CompanyName"'"

part in the code.

--Steve
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 37839710
Well, the DSUM() function only accepts 3 parameters, and when you added the last part, you made it the 4th parameter by separating it from the rest by a comma.  Instead of doing that, you need to append that new criteria on to the end of the previously working criteria.
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

Author Comment

by:SteveL13
ID: 37839724
I'm sorry but I don't know what that means or how to do it.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37839798
Your new criteria looks good for prod plant.  Try separating it from the rest using AND instead of a comma.
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 37839803
Is CompanyName a variable, or do you just want to insert the name of the company inside single quotes?

Me.txtFormsRkfd = DSum("[NumForms]", "tblPrintOrdTranx", "[DateEntered] between #" & Me.txtStart & "# AND #" & Me.txtEnd & "# AND [ProdPlant] = 'CompanyName'")

or maybe

Me.txtFormsRkfd = DSum("[NumForms]", "tblPrintOrdTranx", "[DateEntered] between #" & Me.txtStart & "# AND #" & Me.txtEnd & "# AND [ProdPlant] = " & chr$(34) & strCompanyName & chr$(34))
0
 

Author Comment

by:SteveL13
ID: 37839834
This worked...

Me.txtFormsRkfd = DSum("[NumForms]", "tblPrintOrdTranx", "[DateEntered] between #" & Me.txtStart & "# AND #" & Me.txtEnd & "# AND [ProdPlant] = 'CompanyName'")

Thanks.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37839897
<The previous question today did not have the...
"[ProdPlant] = "'"CompanyName"'"
part in the code.>
Yes, but the sequential steps for troubleshooting are still the same...

Remember you simple said here:
 "What is wrong with..."
You did not stated what you tried
You did not state what errors you got.
You did not state what "CompanyName" was...

<I'm sorry but I don't know what that means or how to do it.>
Dsum (like all aggregate functions) is fairly well documented in the help files.
...and on the web too:
http://www.techonthenet.com/access/functions/domain/dsum.php

Just an FYI...

JeffCoachman
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37840494
Jeff,

To his credit, Steve *showed* what he tried (even though he didnt explicitly state it) and he came pretty close to getting it right independently.  That is the style he generally uses, and I think the questions can be read as "this is what I have tried ... what did I miss?".
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37840718
<To his credit, Steve *showed* what he tried (even though he didnt explicitly state it)>
Point taken

My point was that the original post just stated:
   "What is wrong with..."
There was no mention of:
what *else* was tried
what errors
what "CompanyName" was
What the expression was trying to do...
The part of the expression that was working (from the previous Q)

We all like helping Steve out, and he unusually posts good solid questions, ...but to me, this particular Q was a bit "thin" on those details.
;-)

I know that every once in a while a member will just be in a crunch and just need help ASAP...
;-)

Jeff
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.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

839 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