Solved

IIF And

Posted on 2011-09-24
4
368 Views
Last Modified: 2012-05-12
I know there is probably a simple answer to the below, but I can not get this to run correctly

DstNfin: IIf([DISTANCE]<([DSTFUR]+1.01 And [DISTANCE]>([DSTFUR]-1.01)),[RWNF],0)

What I want is if Distance is between Dstfur plus or minus 1.01 to return RWNF.  If not it would reutrn 0.    For example, DISTANCE is 8 and DSTFUR is 6, would return 0.  If DISTANCE was 8 and DSTFUR is 7, would return RWNF.
0
Comment
Question by:JackJackson54
  • 3
4 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 36592161
Try this:

DstNfin: IIf([Distance] BETWEEN [DSTFUR] - 1.01 AND [DSTFUR] + 1.01, [RWNF],0)

0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 36592165
Parentheses to make it clearer:

DstNfin: IIf([Distance] BETWEEN ([DSTFUR] - 1.01) AND ([DSTFUR] + 1.01), [RWNF],0)

0
 

Author Closing Comment

by:JackJackson54
ID: 36592171
Thank you as that worked.  I tried between late last night and it did not work as I was doing something wrong
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36593165
Glad to help out.

One thing I have found helpful in getting the syntax of these logical statements is to get them out of my head and into writing (pseudocode), and working from there.

Your original post here came very close to speling out the correct syntax :)
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

863 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

20 Experts available now in Live!

Get 1:1 Help Now