Returning a True or False from an IIF statement

by Wheelz   Last Updated January 13, 2018 06:06 AM

I have a query with the following IIF statement

OnlineEnrolment: IIf([qry_ebs_final_CAN-ENROL-ONLINE].[SP_CAN_ENROL]='Y',True,False)

It gives the correct results, but the format that it gives them is what I am struggling with. It responds back with 0 or -1. I want it to respond TRUE or FALSE.

How can I change this other than making TRUE and FALSE strings? I still want them as boolean values.

Thanks

Kieran

Tags : ms-access


Answers 2


This is how TRUE and FALSE work in VBA (and Access): https://stackoverflow.com/questions/4275800/what-are-the-integer-values-of-boolean-false-and-true-in-vb6

If you want a 1 and a 0 like most other programming languages, return 1 and 0 and evaluate that instead of using the keywords TRUE and FALSE. That will make it consistent with other languages, but it won't be internally consistent with Access/VBA.

Something like this:

    IIf([qry_ebs_final_CAN-ENROL-ONLINE].[SP_CAN_ENROL]='Y',1,0)
efesar
efesar
July 02, 2013 16:28 PM

I have three columns in access (MS- Access 2013) A B and C. A & B has mobile numbers. I want to show MD in column C if A & B has same values or AD as column A and B has different values.

Somesh Kaistha
Somesh Kaistha
January 13, 2018 06:03 AM

Related Questions



Export ms access report to excel vba

Updated September 22, 2017 11:06 AM


Access 2010-2016 Compatibility Error

Updated April 18, 2017 06:06 AM