How do i get a number less than 30 to return the letter F in a field?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hmaggie93
    New Member
    • May 2013
    • 6

    How do i get a number less than 30 to return the letter F in a field?

    I have several number values, and i need a different letter returned dependent on the number
    i.e.
    value<30 Returns an F
    31<Value<40 Returns an E
    41<Value<50 Returns an D
    51<Value<60 Returns a C
    61<Value<70 Returns a B
    71<Value Returns an A

    p.s i am new to access, a simplified answer would be greatly appreciated.
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    Where do you get your value from? Another control on a form?

    Comment

    • Hmaggie93
      New Member
      • May 2013
      • 6

      #3
      it's a calculated average in a query.

      Comment

      • Seth Schrock
        Recognized Expert Specialist
        • Dec 2010
        • 2965

        #4
        So are you wanting the returned letter to be returned in that same query?

        Comment

        • Hmaggie93
          New Member
          • May 2013
          • 6

          #5
          I would prefer it in a different query

          Comment

          • Seth Schrock
            Recognized Expert Specialist
            • Dec 2010
            • 2965

            #6
            You would then need to query your existing query to get the values and you would use the switch function to assign the values.
            Code:
            SELECT Switch(MyField < 30, 'F', MyField > 31 AND MyField <40, 'E') As ReturnedLetter
            FROM your_existing_Query
            I'll let you finish off the rest of the possible values.

            Just something to notice, how you have the greater than/less than values setup, 30, 31, 40, 41, 50, 51, 60, 61, 70, & 71 will not show up, so you will need to include some greater than or equal to/less than or equal to equations so that you don't leave any possible values out. I left my example the way that you had it so that you could make the choices yourself.

            Comment

            • Hmaggie93
              New Member
              • May 2013
              • 6

              #7
              Thank you for your time and help, and also pointing out to me the values i had missed!

              Comment

              • Seth Schrock
                Recognized Expert Specialist
                • Dec 2010
                • 2965

                #8
                No problem. Glad to be able to help.

                Comment

                Working...