IF Function in an Access Query

Posted on 2006-04-08
Last Modified: 2012-06-27
Hi, I'd really appreciate help with this Access 2003 problem:

I am trying to write an Expression in a Query that is essentially an IF function.

In plain English it would be:  The field is called BuyGST and it is to calculate:  If there is a Y in a field called GSTRegistered, then the answer is to be BuyCost field * 1.1, else if not true then the answer is to be 0

In Excel it would be =IF(A1="Y",B1*1.1,0)

In Access I wrote the expression as: BuyGST: IF([GSTRegistered]="Y",[BuyCost]*1.1,0)

but it tells me Undefined function 'IF' in expression

Question by:GAILBAKER
    LVL 48

    Accepted Solution

    try use IIF instead? like:

    BuyGST: IIF([GSTRegistered]="Y",[BuyCost]*1.1,0)

    Author Comment

    Trust Microsoft to change the name of the Function - many thanks!!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    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).

    Read about achieving the basic levels of HRIS security in the workplace.
    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 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

    9 Experts available now in Live!

    Get 1:1 Help Now