A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Calculated field for option group



 
 
Thread Tools Display Modes
  #1  
Old April 27th, 2010, 04:24 PM posted to microsoft.public.access.queries
AccessKay
external usenet poster
 
Posts: 106
Default Calculated field for option group

Would anyone mind taking a guess at what might be missing from this
expression for a calculated field in my query (for the first part of my
option group in an unbound form)?

PrevQtr:IIF([Forms]![FrmTest]![ Frame0] = 1, Sum(IIF(Format([TransDate],
"yyyyq") =
Format(DateAdd("q", -1,Date()), "yyyyq"), [ODC_Cost], 0)

Thank you!

  #2  
Old April 27th, 2010, 04:40 PM posted to microsoft.public.access.queries
vanderghast
external usenet poster
 
Posts: 593
Default Calculated field for option group

Missing ) for an expression started by SUM,
Missing a coma and the third argument of the first iif,
Missing ) for the first iif.

PrevQtr: IIF( [Forms]![FrmTest]![ Frame0] = 1,

SUM( IIF( Format([TransDate], "yyyyq")
= Format(DateAdd("q", -1,Date()),
"yyyyq"),
[ODC_Cost],
0
)




Vanderghast, Access MVP



"AccessKay" wrote in message
...
Would anyone mind taking a guess at what might be missing from this
expression for a calculated field in my query (for the first part of my
option group in an unbound form)?

PrevQtr:IIF([Forms]![FrmTest]![ Frame0] = 1, Sum(IIF(Format([TransDate],
"yyyyq") =
Format(DateAdd("q", -1,Date()), "yyyyq"), [ODC_Cost], 0)

Thank you!


  #3  
Old April 27th, 2010, 05:52 PM posted to microsoft.public.access.queries
AccessKay
external usenet poster
 
Posts: 106
Default Calculated field for option group

Thanks for finding this. I'm lousy at writing these. I tried to follow and
now I have too many arguments.

PrevQtr:IIF([Forms]![FrmTest]![ Frame0] = 1, (Sum(IIF(Format([TransDate],
"yyyyq") =
Format(DateAdd("q", -1,Date()), "yyyyq"), [ODC_Cost], 0),0)


"vanderghast" wrote:

Missing ) for an expression started by SUM,
Missing a coma and the third argument of the first iif,
Missing ) for the first iif.

PrevQtr: IIF( [Forms]![FrmTest]![ Frame0] = 1,

SUM( IIF( Format([TransDate], "yyyyq")
= Format(DateAdd("q", -1,Date()),
"yyyyq"),
[ODC_Cost],
0
)




Vanderghast, Access MVP



"AccessKay" wrote in message
...
Would anyone mind taking a guess at what might be missing from this
expression for a calculated field in my query (for the first part of my
option group in an unbound form)?

PrevQtr:IIF([Forms]![FrmTest]![ Frame0] = 1, Sum(IIF(Format([TransDate],
"yyyyq") =
Format(DateAdd("q", -1,Date()), "yyyyq"), [ODC_Cost], 0)

Thank you!


  #4  
Old April 27th, 2010, 06:54 PM posted to microsoft.public.access.queries
vanderghast
external usenet poster
 
Posts: 593
Default Calculated field for option group

SUM takes only one argument, not 2 as typed, actually, you have SUM( iif( ,
, ), 0 )



PrevQtr: IIF([Forms]![FrmTest]![ Frame0] = 1,
(Sum( IIF( Format([TransDate], "yyyyq") =
Format(DateAdd("q", -1,Date()), "yyyyq"),
[ODC_Cost],
0
)
, 0
)



You still have an unbalanced number of parentheses: 8 ( for 6 ).



Vanderghast, Access MVP


"AccessKay" wrote in message
...
Thanks for finding this. I'm lousy at writing these. I tried to follow
and
now I have too many arguments.

PrevQtr:IIF([Forms]![FrmTest]![ Frame0] = 1, (Sum(IIF(Format([TransDate],
"yyyyq") =
Format(DateAdd("q", -1,Date()), "yyyyq"), [ODC_Cost], 0),0)



  #5  
Old April 27th, 2010, 07:42 PM posted to microsoft.public.access.queries
AccessKay
external usenet poster
 
Posts: 106
Default Calculated field for option group

I think I got it...
PrevQtr:IIF([Forms]![FrmTest]![ Frame0] = 1, (Sum(IIF(Format([TransDate],
"yyyyq") = Format(DateAdd("q", -1,Date()), "yyyyq"), [ODC_Cost], 0))),0)

Though, I'm not sure it's what I want...back to making a new one. Thanks
for your assistance. I would have had to stop trying without your help.


"vanderghast" wrote:

SUM takes only one argument, not 2 as typed, actually, you have SUM( iif( ,
, ), 0 )



PrevQtr: IIF([Forms]![FrmTest]![ Frame0] = 1,
(Sum( IIF( Format([TransDate], "yyyyq") =
Format(DateAdd("q", -1,Date()), "yyyyq"),
[ODC_Cost],
0
)
, 0
)



You still have an unbalanced number of parentheses: 8 ( for 6 ).



Vanderghast, Access MVP


"AccessKay" wrote in message
...
Thanks for finding this. I'm lousy at writing these. I tried to follow
and
now I have too many arguments.

PrevQtr:IIF([Forms]![FrmTest]![ Frame0] = 1, (Sum(IIF(Format([TransDate],
"yyyyq") =
Format(DateAdd("q", -1,Date()), "yyyyq"), [ODC_Cost], 0),0)



  #6  
Old April 28th, 2010, 12:24 AM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Calculated field for option group

What about the leading space in [ Frame0] ?

--
Build a little, test a little.


"AccessKay" wrote:

I think I got it...
PrevQtr:IIF([Forms]![FrmTest]![ Frame0] = 1, (Sum(IIF(Format([TransDate],
"yyyyq") = Format(DateAdd("q", -1,Date()), "yyyyq"), [ODC_Cost], 0))),0)

Though, I'm not sure it's what I want...back to making a new one. Thanks
for your assistance. I would have had to stop trying without your help.


"vanderghast" wrote:

SUM takes only one argument, not 2 as typed, actually, you have SUM( iif( ,
, ), 0 )



PrevQtr: IIF([Forms]![FrmTest]![ Frame0] = 1,
(Sum( IIF( Format([TransDate], "yyyyq") =
Format(DateAdd("q", -1,Date()), "yyyyq"),
[ODC_Cost],
0
)
, 0
)



You still have an unbalanced number of parentheses: 8 ( for 6 ).



Vanderghast, Access MVP


"AccessKay" wrote in message
...
Thanks for finding this. I'm lousy at writing these. I tried to follow
and
now I have too many arguments.

PrevQtr:IIF([Forms]![FrmTest]![ Frame0] = 1, (Sum(IIF(Format([TransDate],
"yyyyq") =
Format(DateAdd("q", -1,Date()), "yyyyq"), [ODC_Cost], 0),0)



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:43 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.