Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
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
Reply With Quote
  #3 (permalink)  
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


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:36 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.