Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 13th, 2006, 04:12 PM
Friend of Wrox
 
Join Date: Sep 2005
Location: , , USA.
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Corey
Default Help with IIF Statment

Hello everyone,

I'm trying to put together an IIF statement that goes something like this

iif ([field1] = 51245 then go to ([field2]
and put "156354"

iif ([field1] = 12548 then go to ([field2]
and put "2586487"

iif ([field1] = 357159 then go to ([field2]
and put "5689562"

iif ([field1] = 9273568 to ([field2]
and put "862214"

So basically I'm saying that is a certain number shows up in field one then go to field two and out a certain number in there

or kind or like:
Program ID: IIf([sent]=51459,([Program_ID]),"1667200")

Thank you for any help

Corey
 
Old December 13th, 2006, 06:37 PM
Registered User
 
Join Date: Oct 2006
Location: Leigh, Lancashire, United Kingdom.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Corey

Think you'll find the IIF statement below will work
IIf([Field1]=51245,156354,IIf([Field1]=12548,2586487,IIf([Field1]=357159,5689562,IIf([Field1]=9273568,862214,""))))

Where there is "" at the end can be left or put an alternative in there. I did this as numbers, you can change to text or a mixture if you want. THis need to be placed in an updated query against Field2 to work.

Hope this helps

Martin
 
Old December 14th, 2006, 11:10 AM
Friend of Wrox
 
Join Date: Sep 2005
Location: , , USA.
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Corey
Default

Awesome - Works great!!!!

Thanks a lot Martin






Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested Query with an iif statment Corey Access 7 October 17th, 2005 04:40 PM
Nested Query with an iif statment part 2 Corey Access 1 October 17th, 2005 12:47 PM
if statment knightm28 Classic ASP Databases 2 April 1st, 2005 11:08 AM
SQL Statment btpoole VB Databases Basics 1 February 18th, 2004 01:03 PM
SQL statment arshad mahmood VB Databases Basics 1 July 1st, 2003 02:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.