Solved

A new DSum question

Posted on 2012-04-12
10
212 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
count unique records in access report 2 23
Help writing a query 6 73
Search Form with Run Time Error 3075 1 23
MS Access VBA Print PDF just Current Page 9 15
Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server functions 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 Microsoft Ac…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

863 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

25 Experts available now in Live!

Get 1:1 Help Now