Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2007
    Posts
    19

    Unanswered: Code for adding checkboxes in a report

    Hi All,

    I am working on generating a report to track existing furniture. I have created the table and the form I need and those pieces are working fine. However, I am having trouble coding one feature into my report. I am currently tracking the condition of the furniture: E=Excellent, G=Good, F=Fair and P=Poor. I want to create a sql expression for each of the condition and have it put an X in the field if it matches up with the letter of the furniture's condition. I know that I will have to create 4 expressions one for each condition. I mainly need help with how I would go about writing the expression to achieve this. Thanks in advance.

    Manuel

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    If you mean what I think you mean, try this as the control source of a checkbox:

    =IIf(ConditionField = "E", -1, 0)

    That should check it when the condition is E but not otherwise.
    Paul

  3. #3
    Join Date
    Dec 2007
    Posts
    19

    Thumbs up

    pbaldy

    The chechbox tool worked great. Do you know if it is possible to make the checkbox border invisible. I would like to just see the check mark. Thanks.

    Manuel

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Not that I'm aware of. I've seen people use an embedded image of a check mark and make it visible/invisible as desired.
    Paul

  5. #5
    Join Date
    Dec 2007
    Posts
    19
    Paul-

    Is it possible to use a text and have Access put an 'X' in it if it finds the value to be true? And if so, how should I modify the following code you provided me? Also, where do I add the code? In the Control Source field?

    =IIf(ConditionField = "E", "X")

  6. #6
    Join Date
    Oct 2009
    Posts
    1
    Sorry for Jumping in.
    But you may be better off having your Report Based on a query.
    That way everything is taken care at the query level.
    1. create a query based on your table.
    2. Add a new fields in your query. and use the Code that Paul has suggested.
    for example you could type in Excellent:iif(condition="E","X"," ")
    Add another field Good:iif(condition="G","X"," ")
    and do this for the other conditions.
    Once that is complete just change the data source of your report to the query.

    That way you will have your Data labels and columns lined up.

    Also it is good practice to base reports and forms of off a query and not directly off of tables.

    Hope that helps.

  7. #7
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Quote Originally Posted by Manuel A. Ayala
    Paul-

    Is it possible to use a text and have Access put an 'X' in it if it finds the value to be true? And if so, how should I modify the following code you provided me? Also, where do I add the code? In the Control Source field?

    =IIf(ConditionField = "E", "X")
    Yes, something like:

    =IIf(ConditionField = "E", "X", "")
    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •