?
Solved

IFF expression

Posted on 2012-03-19
6
Medium Priority
?
382 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 - Microsoft MVP, Access and Data Platform) earned 2000 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Closing Comment

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

Expert Comment

by:Dale Fye
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

777 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