IIF statement in SQL

Posted on 2007-10-15
Last Modified: 2010-03-20
I have a query which I need to complete an If statment in the middle. At the moment I have

 IIf([tbl_adequacy_list.dox_fsa] = 0,False,True)

What I would like is for it to say if dox_fsa = True return Yes, otherwise return No; My query is;

INSERT INTO tbl_spn_finalised ( spn_id, spn_long_name, kyc_status, fsa, aml, aof, sub_acct, note_aof_live, notes_aof_archive, date_added )
SELECT tbl_SPNLookup.F1, tbl_adequacy_list.spn_name_a, tbl_kyc_status.kyc_status_name, IIf([tbl_adequacy_list.dox_fsa] = 0,False,True), tbl_adequacy_list.dox_aml, tbl_adequacy_list.dox_aof, tbl_adequacy_list.dox_sub_acct, tbl_adequacy_list.notes_aof_live, tbl_adequacy_list.notes_aof_archive, tbl_adequacy_list.date_added
FROM tbl_SPNLookup INNER JOIN (tbl_kyc_status INNER JOIN tbl_adequacy_list ON tbl_kyc_status.status_id = tbl_adequacy_list.kyc_statis_id) ON tbl_SPNLookup.F1 = tbl_adequacy_list.spn_id
ORDER BY tbl_SPNLookup.F1;
Question by:andyb7901
    LVL 119

    Accepted Solution


    IIf([tbl_adequacy_list.dox_fsa] = 0,No,Yes)


    IIf([tbl_adequacy_list.dox_fsa] = 0,"No","Yes")

    Author Comment

    What is dox_fsa is a yes no field? Would that makea a difference?
    LVL 119

    Expert Comment

    by:Rey Obrero
    what type of data is field fsa on tbl_spn_finalised? is it text or Yes/No field?
    LVL 119

    Expert Comment

    by:Rey Obrero
    <What if dox_fsa is a yes no field?>  Yes/No field = 0 is always false/No

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    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…
    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    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…

    733 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

    23 Experts available now in Live!

    Get 1:1 Help Now