Solved

IFF expression

Posted on 2012-03-19
6
326 Views
Last Modified: 2012-06-27
Why is only the first part working on this?  This only subtracts 5% from all prices.

Iff([DatePosted]>3/4/2012,[Price]-.05*[Price],[Price]-.03*[Price])

I appreciate your help.
0
Comment
Question by:ocdc
  • 3
  • 2
6 Comments
 
LVL 75
ID: 37740764
Try this ... with #'s wrapping the date:

Iff([DatePosted] > #3/4 /2012#, [Price] - 0.05 * [Price], [Price] - 0.03 * [Price])

mx
0
 

Author Comment

by:ocdc
ID: 37740790
the #'s prompt me for a date.  [DatePosted] is the date, so I should not be getting a prompt.
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 37740793
I had one extra space in the date literal ... try this:

Iff([DatePosted] > #3/4/2012#, [Price] - 0.05 * [Price], [Price] - 0.03 * [Price])

or

Iff([DatePosted] > CDate("3/4/2012"), [Price] - 0.05 * [Price], [Price] - 0.03 * [Price])

Are you using this in a query?

mx
0
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.

 

Author Closing Comment

by:ocdc
ID: 37740798
It worked great.  Thanks.
0
 
LVL 75
ID: 37740803
which one ?
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 37741708
I'm assuming you guys meant  IIF( )   not    IFF( )

;-)

You could also have used:

[Price] * (1-iif([DatePosted] > #3/4/2012#, .05, .03))
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

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

867 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

22 Experts available now in Live!

Get 1:1 Help Now