Results 1 to 7 of 7
  1. #1
    mebowman is offline Novice
    Windows 10 Access 2002
    Join Date
    Oct 2023
    Posts
    2

    Display Yes/No Fields from Access to a ColdFusion form

    This is probably a pretty basic question, but I am not that familiar with Access. I am using an older version of Access-2002. I am extracting data from Access to be displayed on a ColdFusion form. The information was initially entered from an HTML page into Access where a series of responses were gathered using a "Yes/No" format and then passed into the Access database into attributes also set up as "Yes/No" fields. However, when these responses are finally displayed on the ColdFusion page, they are displayed as 0 and 1 responses. 0="No", 1="Yes" instead of Yes and No responses. How can this be corrected?

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    You can use an Iif() function to set values of your own choice, so 0 could be "Not yet" and 1 be "Already done".
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    mebowman is offline Novice
    Windows 10 Access 2002
    Join Date
    Oct 2023
    Posts
    2

    Microsoft Access: IIF Function Entry

    Quote Originally Posted by Welshgasman View Post
    You can use an Iif() function to set values of your own choice, so 0 could be "Not yet" and 1 be "Already done".
    I tried doing what you had suggested but still getting the same "0" and "1" as outputs.

    I have attached what I entered into the Expression Builder (=IIF(No,No, Yes) and then clicked "OK" after highlighting the appropriate column in Access. See screenshot below
    As a review, I had entered responses from a CF Form from a "Yes"/"No" box with "No" as the default. So in terms of arguments within the IIF function: (if I am understanding the function correctly)Click image for larger version. 

Name:	Access-IIFSetup.jpg 
Views:	16 
Size:	85.2 KB 
ID:	50870

    1- The first "No" is the default response
    2-The second "No" is the value if the default response is true
    3-The "Yes", is the false value

    I don't know Access all that well, so perhaps I am missing something somewhere? Thanks for any assistance.

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    From my immediate window
    Code:
    tt=True
    ? tt
    True
    ? iif(tt,"Yes","No")
    Yes
    tt=False
    ? iif(tt,"Yes","No")
    No
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    0, no and false all mean the same in access, try

    =IIF(No,”No”, “Yes”)


    note I am on my phone so the double quotes may not translate

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If the field is Yes/No type, Access uses 0 for False and -1 for True. Somehow the export to Cold Fusion converts those Boolean constants to 0 and 1.

    You do not quite understand the IIf() expression. The generic syntax for IIf() is: IIf(this expression equals true or false, return this if true, return this if false)

    The first No in your example is not a "default", it is an expression that determines which of the following two output arguments will be returned. I think the expression build wizard is considering the "return this if True" output as a "default" (I almost never use build wizards). For example, if this expression is like:

    IIf("A" = "B", "True", "Not True"). Since A and B cannot be equal, the result is 0/No/False and the "Not True" text will return.

    If I change the expression to:

    IIf("A" = "A", "True", "Not True"). The return will be "True".

    And since these outputs are within quote marks, they will be actual text, not the Boolean constant True representing -1.

    If you use variable inputs for the equality condition, output will be dynamic instead of static as in my examples. So using a Yes/No field that evaluates to either -1/Yes/True or 0/No/False:

    IIf(fieldname, "True", "False")

    If it helps you to have = sign:

    IIf(fieldname = True, "True", "False")

    Quote Originally Posted by CJ_London View Post
    =IIF(No,”No”, “Yes”)
    That expression will return "Yes". If the desire is to show "No" when condition is 0/No/False, swap the outputs. But this is a static expression. The condition always evaluates to 0/No/False.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    =IIF(No,”No”, “Yes”)




    That expression will return "Yes". If the desire is to show "No" when condition is 0/No/False, swap the outputs.
    You are of course correct

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 10-03-2021, 04:05 PM
  2. Replies: 2
    Last Post: 01-26-2021, 06:44 PM
  3. Replies: 1
    Last Post: 05-03-2020, 12:27 PM
  4. Form doesnt display fields
    By Perfac in forum Forms
    Replies: 3
    Last Post: 02-26-2020, 02:28 PM
  5. Display Fields in Search Form
    By j2curtis64 in forum Forms
    Replies: 1
    Last Post: 07-18-2011, 01:37 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums