473,387 Members | 3,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

If, then syntax error

8
Ok I've read through some other questions on this one and I'm just being particularly dense because I can't seem to figure out how to do this.


Ok some background I've inherrited an Access database that is not ideally set up but it is ok. I keep track of continuing education for lawyers on it.

I have made a report that tracks all the points through a specific time frame. Now many times we know the attorney has taken a class and how many points it is worth but we don't have the certificate proving they attended yet. I've writen my report so that at the report footer it sums all the different points tehy have earned. But I don't want it to sum all of them I only want it to sum the ones that I have a certificate for.

I tried writing this:

IIf([CERTIFICATE ON FILE]=True =Sum([blah blah blah)]

but it tells me basically I need something between the True and =Sum which I would like to be a than. I know how to have it just give me the ones I have a Certificate on but I want to see all the ones in the system between the 2 dates but only the totals for the ones with a cert.

I hope I haven't thoroughly confused the issue. Please help!!
Nov 30 '07 #1
19 2354
puppydogbuddy
1,923 Expert 1GB
Ok I've read through some other questions on this one and I'm just being particularly dense because I can't seem to figure out how to do this.


Ok some background I've inherrited an Access database that is not ideally set up but it is ok. I keep track of continuing education for lawyers on it.

I have made a report that tracks all the points through a specific time frame. Now many times we know the attorney has taken a class and how many points it is worth but we don't have the certificate proving they attended yet. I've writen my report so that at the report footer it sums all the different points tehy have earned. But I don't want it to sum all of them I only want it to sum the ones that I have a certificate for.

I tried writing this:

IIf([CERTIFICATE ON FILE]=True =Sum([blah blah blah)]

but it tells me basically I need something between the True and =Sum which I would like to be a than. I know how to have it just give me the ones I have a Certificate on but I want to see all the ones in the system between the 2 dates but only the totals for the ones with a cert.

I hope I haven't thoroughly confused the issue. Please help!!
try entering it like this in your textbox :

= IIf([CERTIFICATE ON FILE]=True, Sum([blah blah blah]))
Nov 30 '07 #2
hrford
8
try entering it like this in your textbox :

= IIf([CERTIFICATE ON FILE]=True, Sum([blah blah blah]))
it tells me Syntax Error (missing operator)

I've also tried that with and extra set of () around Cert on file and true
Nov 30 '07 #3
Nathan H
104 100+
Where is the "else" statement part of the formula?


= IIf([CERTIFICATE ON FILE]=True, Sum([blah blah blah],""))
Nov 30 '07 #4
puppydogbuddy
1,923 Expert 1GB
Where is the "else" statement part of the formula?


= IIf([CERTIFICATE ON FILE]=True, Sum([blah blah blah],""))
You don't have to have an else....(it is optional-no different than a normal If/end if statement) .....it is, however, a good idea to have the else part if there is a definite action that is done if the condition in the if statement is not met.
Nov 30 '07 #5
Nathan H
104 100+
You don't have to have an else....(it is optional-no different than a normal If/end if statement) .....it is, however, a good idea to have the else part if there is a definite action that is done if the condition in the if statement is not met.
My mistake, I thought it was required on an IIF statement and optional on an IF...
Nov 30 '07 #6
puppydogbuddy
1,923 Expert 1GB
it tells me Syntax Error (missing operator)

I've also tried that with and extra set of () around Cert on file and true
Please post the actual IIf statement you used. Thanks.
Dec 1 '07 #7
missinglinq
3,532 Expert 2GB
Nathan is correct, IIF requires all three arguments!

IIf(expr, truepart, falsepart)


You have to have a falsepart.

And what kind of field is [CERTIFICATE ON FILE]? If it's a text field the True should be "True"

Welcome to TheScripts!

Linq ;0)>
Dec 1 '07 #8
puppydogbuddy
1,923 Expert 1GB
Nathan is correct, IIF requires all three arguments!

IIf(expr, truepart, falsepart)


You have to have a falsepart.

And what kind of field is [CERTIFICATE ON FILE]? If it's a text field the True should be "True"

Welcome to TheScripts!

Linq ;0)>
Linq,

That is really strange because I have used the IIf many times without a false part and it worked fine. I wonder how it works? I suspect in this case, he probably does need a false part because he is summing a column of numbers and omitting the false part would be like summing some null or text values.

it should probably be ,

IIf([CERTIFICATE ON FILE] = True, Sum([blah blah]), 0)
Dec 1 '07 #9
missinglinq
3,532 Expert 2GB
What version are you running? It's definately required in Acc2003! It fails without a falsepart even if you're only doing a simple assignment, like

Me.MyTextControl = IIf(Amount > 1000, "Large Order!")

and generates the error "Argument Not Optional."

Linq ;0)>
Dec 1 '07 #10
puppydogbuddy
1,923 Expert 1GB
What version are you running? It's definately required in Acc2003! It fails without a falsepart even if you're only doing a simple assignment, like

Me.MyTextControl = IIf(Amount > 1000, "Large Order!")

and generates the error "Argument Not Optional."

Linq ;0)>
I am still using Access2000....that must be it......I seem to remember reading somewhere about a change in the IIf syntax after version 2000.
Dec 1 '07 #11
hrford
8
Sorry guys I had a computer free couple of days.

the way I have the exp written now is just to sum everying thing so it reads like this:

=Sum([Practice Management]+[skills]+[other])

What I want it to read is

=IIf[(certificate on file)=True], =Sum([Practice Management]+[skills]+[other]

Now if what I've read is correct I need to tell it that if certficate doesn't equal true then 0 needs to be summed in. How do I do that???

and thank you all sooo much!
Dec 3 '07 #12
hrford
8
I just tried this:

Expand|Select|Wrap|Line Numbers
  1. =IIf([CERTIFICATE ON FILE]=True), =Sum[bla blah], 0
I also tried this

Expand|Select|Wrap|Line Numbers
  1. =IIF(CERTIFICATE ON FILE]=True), =Sum[blah blah], IIf(CERTIFICATE ON FILE]=False, 0
Both times it told me that I didn't have the correct # of operators....
Dec 3 '07 #13
puppydogbuddy
1,923 Expert 1GB
Sorry guys I had a computer free couple of days.

the way I have the exp written now is just to sum everying thing so it reads like this:

=Sum([Practice Management]+[skills]+[other])

What I want it to read is

=IIf[(certificate on file)=True], =Sum([Practice Management]+[skills]+[other]

Now if what I've read is correct I need to tell it that if certficate doesn't equal true then 0 needs to be summed in. How do I do that???

and thank you all sooo much!
Try this:
=IIf([certificate on file]=True, Sum([Practice Management]+[skills]+[other]),0)
Dec 3 '07 #14
hrford
8
Try this:
=IIf([certificate on file]=True, Sum([Practice Management]+[skills]+[other]),0)

I then get

"You may have entered a comma without a precding value or identifier"

this is really annoying!
Dec 3 '07 #15
hrford
8
I've tried gonig about this a slightly different way I wrote:

Expand|Select|Wrap|Line Numbers
  1. =IIf(IsNull(CERTIFICATE ON FILE),"0",(Sum([blah]+[blah]))

but it tells me that I am missing a closing parenthesis or bracket but I can't figure out where???
Dec 3 '07 #16
Nathan H
104 100+
I then get

"You may have entered a comma without a precding value or identifier"

this is really annoying!

Are you doing the calculation in the report footer? You should run the calculation in the reports query source in a new column:

PointTotal: IIf([certificate on file]=True,([Practice Management]+[skills]+[other]),0)

and then sum the total of the field "PointTotal" in the report footer. =Sum([PointTotal])
Dec 3 '07 #17
puppydogbuddy
1,923 Expert 1GB
I've tried gonig about this a slightly different way I wrote:

Expand|Select|Wrap|Line Numbers
  1. =IIf(IsNull(CERTIFICATE ON FILE),"0",(Sum([blah]+[blah]))

but it tells me that I am missing a closing parenthesis or bracket but I can't figure out where???
=IIf(IsNull([CERTIFICATE ON FILE]),0,Sum([blah]+[blah]))

Also try this:
=IIf([CERTIFICATE ON FILE]=True, Sum([Practice Management]+[skills]+[other]),0)
Dec 3 '07 #18
hrford
8
Are you doing the calculation in the report footer? You should run the calculation in the reports query source in a new column:

PointTotal: IIf([certificate on file]=True,([Practice Management]+[skills]+[other]),0)

and then sum the total of the field "PointTotal" in the report footer. =Sum([PointTotal])

It works!!!

Thank you soooo much!
Dec 3 '07 #19
Nathan H
104 100+
It works!!!

Thank you soooo much!

Cool deal! Good Luck.
Dec 3 '07 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Steve | last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone can explain to me why it was reported that way. ...
1
by: Donald Canton | last post by:
Hi, I'm using Bjarne's book to learn C++ and am stuck on the Calc program in Section 6. Everything works fine except when I try to use istringstream to parse a token from the command line. I...
5
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by...
2
by: david | last post by:
Anyone could give me a hand about this syntax error? Thank you. David Source Code: Dim conn As New SqlConnection(strConn) Dim daAngio As New SqlDataAdapter(strSelectStatement, conn) 'Create a...
3
by: Manuel | last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using devc++. So I've imported the glut32.dsp into devc++, included manually some headers, and start to compile. It return a very...
1
by: Hari Sekhon | last post by:
I've written an except hook into a script as shown below which works well for the most part and catches exceptions. import sys def myexcepthook(type,value,tb): do something ...
7
by: Josh | last post by:
I have a lot of except Exception, e statements in my code, which poses some problems. One of the biggest is whenever I refactor even the triviallest thing in my code. I would like python to...
7
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
6
by: muby | last post by:
Hi everybody :) I'm modifying a C++ code in VC++ 2005 my code snippet void BandwidthAllocationScheduler::insert( Message* msg, BOOL* QueueIsFull,
5
Banfa
by: Banfa | last post by:
So I have a little problem, I have a template class and that class contains a template function; now what I want to do is declare that function in the class (or indeed the entire class) as a friend...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.