Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Queries

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 09-08-2008, 11:46 PM
Novice
 
Join Date: Sep 2008
Posts: 7
nshaikh is on a distinguished road
Default How to use IIF condition

I am having data of city, against which i want state in next field and using iif condition.Getting error - The expression you entered has a function containing the wrong number of arguments.
city---State
AHMEDABAD,SURAT,VADODARA --- GUJARAT
MUMBAI,NAVI,PUNE --- MAHA
HYDERABAD,VISHAKAPATNAM --- ANDHRA
CHENNAI --- TAMIL
BANGLORE --- KARNA
GURGAON --- HARYANA

STATE: IIf([CELL],[AHMEDABAD],[Gujarat],iif([CELL],[SURAT],[Gujarat],iiF([CELL],[Vadodara],[Gujarat],IIf([CELL],[Mumbai],[Maha],IIf([CELL], [Navi],[Maha],IIf([CELL],[Pune],[Maha],IIf([CELL],[HYDERABAD],[Andhra],IIf([CELL],[VISHAKAPATNAM],[ANDHRA],IIf([CELL],[CHENNAI],[TAMIL],IIf([CELL],[BANGLORE],[KARNA],IIf([CELL],[GURGAON],[HARYANA])))))))))))

Want to know is there any other way i.e using (And,Or) in iif condition.
or some other way where two to three condition matches for similar result i.e city HYDERABAD,VISHAKAPATNAM Should have Andhra in state field.
Attached Files
File Type: mdb TEST1.mdb (112.0 KB, 1 views)
Reply With Quote
  #2  
Old 09-09-2008, 06:41 AM
jya jya is offline Windows XP Access 2007 (version 12.0)
Competent Performer
 
Join Date: Sep 2007
Location: Chicagoland
Posts: 109
jya is an unknown quantity at this point
Default Abbreviated Response

I suspect you are looking for something like this

State: IIf([City]='AHMEDABAD' Or [City]='SURAT','GUJARAT',IIf([City]='MUMBAI' Or [City]='NAVI','MAHA','No match'))
Reply With Quote
  #3  
Old 09-10-2008, 09:57 PM
Novice
 
Join Date: Sep 2008
Posts: 7
nshaikh is on a distinguished road
Default Thanks a ton

Hey Thanks

But want to know in a iif condition can we put three option i.e IIf([City]='AHMEDABAD' Or [City]='SURAT', Or [City]='VADODARA','GUJARAT'.

Please help...
Reply With Quote
  #4  
Old 09-11-2008, 04:19 AM
jya jya is offline Windows XP Access 2007 (version 12.0)
Competent Performer
 
Join Date: Sep 2007
Location: Chicagoland
Posts: 109
jya is an unknown quantity at this point
Default

Yes, it can take mutiple options.
Reply With Quote
  #5  
Old 09-11-2008, 11:23 PM
Novice
 
Join Date: Sep 2008
Posts: 7
nshaikh is on a distinguished road
Default Thanks

How it can be done, please show it..
Reply With Quote
Reply

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 10:16 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.