Solved

IIF Function based on a Value and a Calculation

Posted on 2013-07-01
5
359 Views
Last Modified: 2013-07-02
I have two fields; One that has a static number from a linked report and the other which I created based on Calculations from two other fields.

I created a IIF Statement:  Odd Match: IIf([Speed 1]=[Speed 2],1,0)

Speed 1 is the static number and Speed 2 is the calculated field based off of two other fields.

They are all set as numbers, yet they are not agreeing.

Do you have any suggestions of what I should look for?

Feeling a little dumb right now...
0
Comment
Question by:ammiewinds
  • 2
  • 2
5 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39291449
this is just a test to see if your expression works

 Odd Match: IIf(Int([Speed 1])=Int([Speed 2]),1,0)
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 39291477
Depends on your calculations and the datatypes of the static number and the computed value.  If they are double or single precision numbers, there could be some rounding error in the computed value.  If that is the case, you might want to try:

Odd Match: IIF(Abs([Speed 1] - [Speed 2]) < .01, 1, 0)

This would check to see if the values are within 0.01 of each other.  Rounding error generally occur deep below the decimal point, so you might want to replace .01 with .0000001 or something like that.
0
 

Author Comment

by:ammiewinds
ID: 39291514
Hi Cap,
Sorry, the integer did not work. :-(

Hi Fryed,
Fantastic!  Thank you so much.

Thank you both for the prompt reponses.

Have a marvelous day!
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39291875
That's "fyed", not "Fryed".  LOL

Glad to help
0
 

Author Comment

by:ammiewinds
ID: 39294211
LOL  Sorry.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

856 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