Nesting and Incorrect Syntax

  • Thread starter Thread starter Melissa Thompson via AccessMonster.com
  • Start date Start date
M

Melissa Thompson via AccessMonster.com

IIf(([CourseCode]="076051WPL00" And [Completed]=-1),"Completed","Not
Completed")
IIf(([CourseCode]="076051WPL01" And [Completed]=-1),"Completed","Not
Completed")

I have these two statements that I had in two seperate columns but the
results are not correct. What am doing wrong? HOw can I nest these?
 
IIf(([CourseCode]="076051WPL00" And [Completed]=-1),"Completed","Not
Completed")
IIf(([CourseCode]="076051WPL01" And [Completed]=-1),"Completed","Not
Completed")

I have these two statements that I had in two seperate columns but the
results are not correct. What am doing wrong? HOw can I nest these?

When you write "the results are not correct" that does not really tell
us much. What do you get? What do you want to get? Where are yiou
doing this. In an Access control's control source? In VBA?

I'll give a guess.
In an Access query (since you mention two separate columns):

NewColumn:IIf(([CourseCode]="076051WPL00" And [Completed]=-1) Or
([CourseCode]="076051WPL01" And [Completed]=-1),"Completed","Not
Completed")
 
You can create one iif statement for the two you have
IIf(([CourseCode]="076051WPL00" Or [CourseCode]="076051WPL01") And
[Completed]=True,"complete","not complete")

Assuming that the field Completed is True/False Type. Other wise write -1
 
The reason why I said the results are not correct because the base pop is
199. When I run another query and add this I get 214 rows. I got duplicates
based on SSN. I noticed that a few off my rows are returned with the course
code and a completed indicator as it should be. Then another row with the
same course code and not completed and that is incorrect. The reason why I
said I needed to columns is because I have to show each course code and its
indicator. I hope this makes sense. If I nest it I will only return one
column and I won't know which course the complete or not complete indicator
is for....
 
By the way this is an Access query. (Sorry for the types above).

Melissa
 
Without knowing what your tables look like and what your query looks like,
it's virtually impossible to give you a complete answer, as we'd just be
guessing.

Please post a list of what tables are involved, the relevant fields in those
tables and what your SQL looks like.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top