Solved

A new DSum question

Posted on 2012-04-12
10
211 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
 

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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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 Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 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

20 Experts available now in Live!

Get 1:1 Help Now