Results 1 to 14 of 14
  1. #1
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Changing Report Ouput (Access 97 SR1)

    I currently have a report that prints out a number in each record indicating priority, i.e. 1, 2 or 3 for Hi, Med and Low. The numbers are created by using radio buttons on a form. However, I would like to have the report print "Hi", "Med" and "Low" instead of the numbers. I'm sure there is some simple code using, perhaps, a Case statement do accomplish this. Can anyone suggest something here?

    Thanks,

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Changing Report Ouput (Access 97 SR1)

    Try either the Choose or the Switch function. I would go with Choose if the values are numeric and sequential. The syntax would be

    Choose([Priority],"Hi","Med","Low")

    ... assuming that Priority is the name of the field in the recordset. You could even generate the string in a calculated field in the underlying query and just bind the report control to that field.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing Report Ouput (Access 97 SR1)

    If your priority field consists of a number and on the report you want its word value you could create the following nested iif calculation:

    =iif([priority]=1,"Hi",iif([priority]=2,"Med",iif([priority]=3,"Low"," ")))

    If the data type for your priority code is text rather than a number data type, be sure to place quotes around each number in the calculated statement.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Changing Report Ouput (Access 97 SR1)

    Choose or Switch will perform better than IIf, however.
    Charlotte

  5. #5
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Changing Report Ouput (Access 97 SR1)

    Thanks Charlotte, I created a new field called PText in the query, and my report now displays Hi, Med and Low in the priority column.

    Next challenge. How do I change the text colors so Hi is red and Med is yellow?

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Changing Report Ouput (Access 97 SR1)

    Someone just asked the same question in <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Cat=&Board=acc&Number=68067&page=& view=&sb=&o=&vc=1#Post68067>this thread</A>. Take a look there.
    Charlotte

  7. #7
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Changing Report Ouput (Access 97 SR1)

    Thanks again. Everything worked out just great!

  8. #8
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Changing Report Ouput (Access 97 SR1)

    >>I currently have a report that prints out a number in each record indicating priority, i.e. 1, 2 or 3 for Hi, Med and Low. The numbers are created by using radio buttons on a form. However, I would like to have the report print "Hi", "Med" and "Low" instead of the numbers<<

    Chuck,

    YOu could just put a combo box on your report. Set RowSourceType as ValueList, and set RowSource to "1;Hi;2;Med;3;Low". Set to 2 columns, with widths 0";0.5".
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  9. #9
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Changing Report Ouput (Access 97 SR1)

    Hi Mark,

    Thanks for your suggestion -- that's the third method that has been suggested. My goodness! There seems to be no end to the ways to accomplish every task one asks of Access. I appreciate everyone's cooperative spirit. The Lounge is really a great resource.

  10. #10
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing Report Ouput (Access 97 SR1)

    What would be the syntax of using choose or switch in lieu of IIf? I looked it up each of these words in Access 2000 help but did not understand how this would work.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

  11. #11
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing Report Ouput (Access 97 SR1)

    Like Charlotte says in her first answer to Chuck the syntax for choose :
    <pre>Choose([Priority],"Hi","Med","Low")</pre>

    for Switch :
    <pre>Switch([Priority] = 1, "Hi", [Priority] = 2,"Medium",[Priority] = 3,"Low")</pre>

    For Choose, Priority has to be numeric.
    For Switch, if Priority is a string, then put 1,2 and 3 between quotes
    They are in the help file of VBA.
    Francois

  12. #12
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing Report Ouput (Access 97 SR1)

    Thanks. I was looking in the regular Access help rather than VBA help. Your explanation helped clairify for me how to use choose and switch which as Charlotte said are much easier than IIf.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

  13. #13
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Changing Report Ouput (Access 97 SR1)

    Hi Judy,

    Here is the Choose function that I entered in a field definitioin in the query upon which my report is based

    : PText: Choose([Priority],"Hi","Med","Low")

    Thus, I didn't have to use multiple IIF's. The Priority field in the related table was restricted to the entries 1, 2 and 3 representing Hi, Med & Low priority.

  14. #14
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing Report Ouput (Access 97 SR1)

    That's the reason for reading every post on this board because even if you think you know how to accomplish something, quite often someone else knows a better or easier way.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

Posting Permissions

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