Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2003
    Location
    Longmont, CO
    Posts
    258

    Unanswered: How to deal w/ combo values on report

    DOH! This would be so easy if it wasn't Access!

    Access 2K/XP

    I have a report that needs to present the value that was stored out of a combo box on a form. In the table is 0, 1 or 2. On the report I need "Eligible", "Not Eligible" or "Pending". I don't seem to be able to put a case into the query and IIF only handles 2 values. There is no reference table for the values from the combo box.

    How do you do this?

    Thanks!

  2. #2
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Use a nested iif or the switch function in the query.

  3. #3
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    i don't suppose you could just check each record on the report (the Detail_Print() ) and change it, could you? meaning, in your Sub Detail_Print() put

    Code:
    If form!combo.Value = 0 Then
      textbox.Value = "Eligible"   'this would be your textbox on your report
    End If
    If form!combo.Value = 1 Then
      textbox.Value = "Not Eligible"
    End If
    If form!combo.Value = 2 Then
      textbox.Value = "Pending"   
    End If
    would that make any sense? i may be misunderstanding your question. i tend to do that a lot...good luck.

  4. #4
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Smile

    Quote Originally Posted by Fly Girl
    DOH! This would be so easy if it wasn't Access!

    Access 2K/XP

    I have a report that needs to present the value that was stored out of a combo box on a form. In the table is 0, 1 or 2. On the report I need "Eligible", "Not Eligible" or "Pending". I don't seem to be able to put a case into the query and IIF only handles 2 values. There is no reference table for the values from the combo box.

    How do you do this?

    Thanks!
    Hi,
    Just wondering, for your ComboBox do you have the values Eligible, Not Eligible and Pending stored in it along with the 0,1,2 values? If in your ComboBox you set it up with 0=Eligible, 1=Not Eligible, 2=Pending, then just pull those values into the report. IF you don't then that would be an easy way to do it, then your fields will automatically show. I'll be checking back later.
    Bud

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    I don't understand why you would need a combo box to do this... would a text box with a nested iif() statement not cut it?

    =iif(status = 0, "Eligible", iif(status = 1, "Not Eligible", "Pending"))

    ??
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  6. #6
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Quote Originally Posted by Fly Girl
    DOH! This would be so easy if it wasn't Access!

    Access 2K/XP

    I have a report that needs to present the value that was stored out of a combo box on a form. In the table is 0, 1 or 2. On the report I need "Eligible", "Not Eligible" or "Pending". I don't seem to be able to put a case into the query and IIF only handles 2 values. There is no reference table for the values from the combo box.

    How do you do this?

    Thanks!
    Hi Fly Girl,
    Check out the sample db attached...I tried to create what you were inquiring about in the way you seemed to want it. However a NestedIf statement is a good thing. Take a look and see what you think. If this doesn't get it I will try another way for you.

    here to help,
    Bud
    Attached Files Attached Files

  7. #7
    Join Date
    Jun 2003
    Location
    Longmont, CO
    Posts
    258
    Thanks Guys!

    I'm currently beating something else into submission but it looks like either checking the control on the form (I believe the report will print off of a custom button on the toolbar of the form with this field) or the nested iif will do the job.

    BTW, how many nests can you make in those IIF's? Can I do =iif(status = 0, "Eligible", iif(status = 1, "Not Eligible", IIF(status = 2, "Pending", ""))?

    Oh how I love T-SQL and it's case statements!

    I'll let you know how things are going later.

  8. #8
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You can do your suggested:

    =iif(status = 0, "Eligible", iif(status = 1, "Not Eligible", IIF(status = 2, "Pending", ""))

    if you would like. You can actually nest just about as many iif()'s as you feel fit. However, the suggestion:

    =iif(status = 0, "Eligible", iif(status = 1, "Not Eligible", "Pending"))

    Is a bit more to the point. Whereas if the status is NOT 0 or 1, then it must be pending.

    Unless of course there is the possibility of the value not being 0,1 or 2. Then you have a good plan.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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