Results 1 to 9 of 9
  1. #1
    darwish is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    26

    put yes/no instead 1/0

    hello



    i have a query getting information from a table called prints
    this table contains a column called "booksincluded" with values "1" and "0"
    i also have a subform getting information from this query.
    what i want is that when i view data in the subform, the booksincluded column when its value is "1", i want it to display "yes" instead of "1", and when the value is "0", I want the subform view "no"

    i tried this statement in the criteria field but it didnt work out. =IIf([print_isbook]=1,"yes","no") an error occurs displaying "data type missmatch in criteria expression"

    how i can solve that issue?

    any help is appreciated

    thank you

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    What is the data type of the "booksincluded" field in your underlying table?

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    try; [print_isbook]="1"

    that is the correct syntax for a text field type - - - without the quotations would work only if it is a number field type

  4. #4
    darwish is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    26
    i tried [print_isbook]="1" and its still giving me same error, also the same for no quotations

    the data type of "
    booksincluded" is Number



  5. #5
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    So, what is the relationship between booksincluded and [print_isbook]?
    Is booksincluded the control source for [print_isbook] straight-up, as-is?
    Or does it go through some calculation in a query or in the Text Box Control Source first?

  6. #6
    darwish is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    26
    booksincluded is the caption name of the column "print_isbook"

    here is the query in sql view:

    SELECT Templates.temp_name, Customer.Customer_Name, Form.form_name, Parts.Parts_value, Size.Size_name, Type.Type_name, Prints.print_boxcapacity, Prints.print_quantity, Prints.print_noofboxes, Prints.print_startnumbering, Prints.print_date, Prints.print_dateon, Left(Prints.print_slov,Len(Prints.print_slov)-1) AS SLO, Prints.print_pov, Prints.print_opt1name, Prints.print_opt1value, Prints.print_isbook
    FROM Templates INNER JOIN (Type INNER JOIN ([Size] INNER JOIN (Parts INNER JOIN (Form INNER JOIN (Customer INNER JOIN Prints ON Customer.Customer_ID = Prints.print_Customer) ON Form.Form_ID = Prints.Print_form) ON Parts.Parts_ID = Prints.print_parts) ON Size.Size_ID = Prints.print_size) ON Type.Type_ID = Prints.print_types) ON Templates.temp_ID = Prints.print_name
    WHERE (((Prints.print_isbook)=IIf([print_isbook]=1,"Yes","No")));

  7. #7
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    this table contains a column called "booksincluded" with values "1" and "0"
    booksincluded is the caption name of the column "print_isbook"
    So, the field in the underlying table is in fact not actually named "booksincluded", but rather "print_isbook"?

    So if you go to the "prints" table, and bring up the "print_isbook", what is the Data Type and Format?

    And what exactly are you trying to do here?
    Code:
    WHERE (((Prints.print_isbook)=IIf([print_isbook]=1,"Yes","No")));

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    If you just want to display alias values for 1/0, then this expression should not be in CRITERIA row, it should be in FIELD row to create a field by expression. Or in the ControlSource of textbox.
    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.

  9. #9
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    If this is strictly for showing on a subform you can make a combo box that has 2 columns, make the bound column your table value (1 or 0), associate the 1 with "Yes" the 0 with "No".

    So your combo box would have a VALUE list instead of TABLE/QUERY and your string for your value list would look like

    1, "Yes", 0, "No"

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

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