Solved

How would you write the following Access query statement in pseudocode - IIf([SL]="L",IIf([Direction]="Credit","D","C"),IIf(Direction="Credit","A","B")) AS T ?

Posted on 2014-01-15
7
615 Views
Last Modified: 2014-01-15
How would you read this full statement in pseudocode from an Access application?

 IIf([SL]="L",IIf([Direction]="Credit","D","C"),IIf(Direction="Credit","A","B")) AS T
0
Comment
Question by:zimmer9
7 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
Comment Utility
What do you mean by "pseudocode"? The item you've posted is "code" so I'm not sure what you need.

If you're looking for something like a "human translation", then:

Check the value of [SL].

If it the value of [SL] equals "L", then check the value of [Direction]. If the value of [Direction] equals "Credit" then return "D". If  it does not equal "Credit" then return a "D"

If the value of [SL] does not equal "L", then check the value of [Direction]. If the value of [Direction] equals "Credit" then return "A". If it does not equal "Credit" then return "B"
0
 
LVL 7

Expert Comment

by:Steve
Comment Utility
Spot on except:


Check the value of [SL].

If it the value of [SL] equals "L", then check the value of [Direction]. If the value of [Direction] equals "Credit" then return "D".
 If  it does not equal "Credit" then return a

"C"


If the value of [SL] does not equal "L", then check the value of [Direction]. If the value of [Direction] equals "Credit" then return "A". If it does not equal "Credit" then return "B"
0
 
LVL 7

Expert Comment

by:Steve
Comment Utility
Scott really should have gotten that credit, I simply pointed out a typo.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:zimmer9
Comment Utility
How would I modify my answer.
0
 
LVL 30

Expert Comment

by:hnasr
Comment Utility
Your statement should be:
 IIf([SL]="L",IIf([Direction]="Credit","D","C"),"B")) AS T


IF SL = "L"
      IF Direction = "Credit"
            "D"
      ELSE
            "C"
      END IF
ELSE
      "B"
END IF
0
 
LVL 34

Expert Comment

by:PatHartman
Comment Utility
@hnasr,
Your suggestion omits one of the options.
There are two conditions, each with two outcomes so you should have four possible results.  Your recast expression has only three.

IF SL = "L"
      IF Direction = "Credit"
            "D"
      ELSE
            "C"
      END IF
ELSE 
      IF Direction = "Credit"
            "A"
      ELSE
            "B"
      END IF
END IF 

Open in new window

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now