UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Too Many Arguments, Access 2010    
 
   
rizmin
post Aug 24 2017, 04:12 AM
Post#1



Posts: 120
Joined: 10-August 17



Hi All.

I have used to get the yearly Manhours by using following expression but when i Just open the report following error message is appearing,

=Sum(IIf([IncidentClassification] In ("1.Manhours"),(CInt(Nz([Jan],0))+CInt(Nz([Feb],0))+CInt(Nz([Mar],0))+CInt(Nz([Apr],0))+
CInt(Nz([May],0))+CInt(Nz([Jun],0))+CInt(Nz([Jul],0))+CInt(Nz([Aug],0))+CInt(Nz([
Sep],0))+CInt(Nz([Oct],0))+CInt(Nz([Nov],0))+[Dec]),0))

Anyone can help me on this,

Thank you very much!!
Attached File(s)
Attached File  Capture.JPG ( 28.79K )Number of downloads: 4
Attached File  Capture.JPG ( 28.79K )Number of downloads: 4
 
Go to the top of the page
 
BruceM
post Aug 24 2017, 06:39 AM
Post#2


UtterAccess VIP
Posts: 7,022
Joined: 24-May 10
From: Downeast Maine


The short answer if that the Dec expression is typed differently than the others, so the ) after [Dec] is the closing parentheses for IIf, but the IIf expression needs an Else condition. The ,0 is within the Sum parentheses, but Sum does not accept the extra argument. The final parentheses is extra.

The longer answer is that I don't think you can use In as you have done, but in any case "1.Manhours" is a literal string, so even if the In was working it would be, in effect:

IIf([IncidentClassification] = "1.Manhours"...

Another issue is that it seems you are using the months as field names. Using months as column headers in a spreadsheet is OK, but Access is not a spreadsheet. Attempting to use it as one is both difficult and ineffective. Your best option is to reconsider the design. This link can provide some guidance about better ways to manage the structure to support your requirements.
Go to the top of the page
 
rizmin
post Aug 24 2017, 07:00 AM
Post#3



Posts: 120
Joined: 10-August 17



HI BruceM

Thanks for your reply, I have used the following expression now its working well

=(Sum(IIf([IncidentClassification] In ("1.Manhours"),(CDbl(Nz([Jan],0))+CDbl(Nz([Feb],0))+CDbl(Nz([Mar],0))+CDbl(Nz([Apr],0))+
CDbl(Nz([May],0))+CDbl(Nz([Jun],0))+CDbl(Nz([Jul],0))+CDbl(Nz([Aug],0))+CDbl(Nz([
Sep],0))+CDbl(Nz([Oct],0))+CDbl(Nz([Nov],0))+CDbl(Nz([Dec],0))),0)))

Thanks
Go to the top of the page
 
BruceM
post Aug 24 2017, 07:27 AM
Post#4


UtterAccess VIP
Posts: 7,022
Joined: 24-May 10
From: Downeast Maine


Best of luck with the project. I encourage you to review the database design principles. You are making this much harder than it has to be.
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    16th December 2017 - 02:11 AM