Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 25th, 2005, 10:43 AM
Rishyraj Rishyraj is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 53 Rishyraj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 29 m
Reputation Power: 4
Arrow iif statement

Hi there,

I have a small problem in the iif statement of a query.

Iif([officer]="a","good",[officer]) simple condition and it works.

iif instead of one officer as "a" we have a, b, c, d, e, f, g. How do i give the condition which would work as the first condition.

iif([officer]="a""b""c""d""e""f""g","good",[officer]) does not work. I know its wrong, can any one please give me the correct condition/statement.

Thanks for your help.

Raj

Reply With Quote
  #2  
Old January 25th, 2005, 11:32 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 4
Raj,

Try something like this

IIf([officer]>= "a" Or [officer]<="g","good",[officer])

Didn't test, so just try for now and post back if that didn't work.
lwells

Reply With Quote
  #3  
Old January 25th, 2005, 01:53 PM
Rishyraj Rishyraj is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 53 Rishyraj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 29 m
Reputation Power: 4
Arrow

Iwells,

I am sorry, I was not clear. I just used a,b,c,d etc as an example. Infact the data consists of names of the officers (that are not in any sequence) but i want to group a set of officers from a list using a query under a separate department using the iif statement/or condition and then total the amount for that dept.

Thank you

Raj













Quote:
Originally Posted by lwells
Raj,

Try something like this

IIf([officer]>= "a" Or [officer]<="g","good",[officer])

Didn't test, so just try for now and post back if that didn't work.
lwells

Reply With Quote
  #4  
Old January 25th, 2005, 02:30 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 4
Sorry Raj,

Still not clear of what you want then. The IIf statement looks for a name of officers and then returns "good" as the True part, and the the name of the "officer" if False, doesn't sound like a logical criteria to be put under the field name for officers for the filter. I understand about grouping officers together to get a sum, but why are you using the IIf statement. Your criteria under the field listing the officers name would simply be "Officer1" Or "Officer2" Or "Officer3" etc. using the names that are actually in the field. Better yet, if all the officers belong to the same department, shouldn't you just sort by the department?

lwells

Reply With Quote
  #5  
Old January 25th, 2005, 04:33 PM
Rishyraj Rishyraj is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 53 Rishyraj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 29 m
Reputation Power: 4
Iwell,

Got your point. But to give you the idea behind it. we have around 12 loan officers out of which 6 are of our dept and the rest are from other dept. But even they some time chip in loans specific to our dept example consumer loan.

I have the data base..when i make cross tab query we are more concerned with our officers performance and want to pool all other dept officers loans in to one pool. We do not have segregation of dept as pointed out by you. So, my logic was in the query which has the fields like

name of the borrower
loan amount
date
officer

If i can give the iif criteria or any criteria you can think of, to have detail listing by name for our dept officers and MSC across the names of other dept officers there by cross tab query would reflect MSC for all other officers loans.

Hope that make sense.

Any other suggestion is welcome. We can not amend the database/form structure. We have to think only from query point of view.

Thank you

Raj





Quote:
Originally Posted by lwells
Sorry Raj,

Still not clear of what you want then. The IIf statement looks for a name of officers and then returns "good" as the True part, and the the name of the "officer" if False, doesn't sound like a logical criteria to be put under the field name for officers for the filter. I understand about grouping officers together to get a sum, but why are you using the IIf statement. Your criteria under the field listing the officers name would simply be "Officer1" Or "Officer2" Or "Officer3" etc. using the names that are actually in the field. Better yet, if all the officers belong to the same department, shouldn't you just sort by the department?

lwells

Reply With Quote
  #6  
Old January 25th, 2005, 05:37 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 4
Hi Raj,

Okay, makes sense now. What you are wanting to do was to is create an expression (I thought you were trying to create a sort criteria) that will identify the officer name and if they belong to your department show them with their actual name, but if they belong to another department show them as MSC. That way in your cross tab you have the individual names and then the rest as MSC. Try this for your IIf statement and see if your cross tab will work like you want:

IIf([officer]="Name1" Or [officer]="Name2" Or [officer]="Name3","MSC",[officer])

In the above if Name1 for example didn't belong to your department it would be given the True of MSC.

It is too bad you couldn't make a change to the table and assign the officers to a department...would sure make things easier for you.

lwells

Last edited by lwells : January 25th, 2005 at 05:40 PM.

Reply With Quote
  #7  
Old January 26th, 2005, 08:39 AM
Rishyraj Rishyraj is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 53 Rishyraj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 29 m
Reputation Power: 4
Thank you very much, Iwell. It helped.







Quote:
Originally Posted by lwells
Hi Raj,

Okay, makes sense now. What you are wanting to do was to is create an expression (I thought you were trying to create a sort criteria) that will identify the officer name and if they belong to your department show them with their actual name, but if they belong to another department show them as MSC. That way in your cross tab you have the individual names and then the rest as MSC. Try this for your IIf statement and see if your cross tab will work like you want:

IIf([officer]="Name1" Or [officer]="Name2" Or [officer]="Name3","MSC",[officer])

In the above if Name1 for example didn't belong to your department it would be given the True of MSC.

It is too bad you couldn't make a change to the table and assign the officers to a department...would sure make things easier for you.

lwells

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > iif statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway