Looking up values

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Mendez

    #1

    Looking up values

    How can look up a value in access if I have a table (GPA) with all the
    endpoints. Below, is the exact table. For example, if someones grade
    averaged to a 2.43, since the 2.43 lies within the 2.33-2.67 interval,
    then the letter grade would be a B-. Please help!!!!

    GPA Letter_Grade
    0 F
    0.33 D-
    0.67 D
    1 D+
    1.33 C-
    1.67 C
    2 C+
    2.33 B-
    2.67 B
    3 B+
    3.33 A-
    3.67 A
    4 A+
    I understand I could us an if statement of some sort but there are too
    many intervals.

    Thanks
  • Yannick Turgeon

    #2
    Re: Looking up values

    Here is my solution. Air coded...

    -----------------
    Public Function getLetterGrade( Byval Grade AS Double) As String
    getLetterGrade = Nz(DLookup("Let ter_Grade", "GPA", "GPA = " &
    DMax("GPA", "GPA", "GPA <= 2.43")))
    End Function
    -----------------

    HTH

    Yannick

    "Paul Mendez" <pmendez@thelyn dco.com> wrote in message
    news:99915b66.0 406080700.7d438 9a@posting.goog le.com...[color=blue]
    > How can look up a value in access if I have a table (GPA) with all the
    > endpoints. Below, is the exact table. For example, if someones grade
    > averaged to a 2.43, since the 2.43 lies within the 2.33-2.67 interval,
    > then the letter grade would be a B-. Please help!!!!
    >
    > GPA Letter_Grade
    > 0 F
    > 0.33 D-
    > 0.67 D
    > 1 D+
    > 1.33 C-
    > 1.67 C
    > 2 C+
    > 2.33 B-
    > 2.67 B
    > 3 B+
    > 3.33 A-
    > 3.67 A
    > 4 A+
    > I understand I could us an if statement of some sort but there are too
    > many intervals.
    >
    > Thanks[/color]


    Comment

    • Yannick Turgeon

      #3
      Re: Looking up values - Oups!

      A correction. New version:
      -----------------
      Public Function getLetterGrade( Byval Grade AS Double) As String
      getLetterGrade = Nz(DLookup("Let ter_Grade", "GPA", "GPA = " &
      DMax("GPA", "GPA", "GPA <= " & Grade)))
      End Function
      -----------------


      "Yannick Turgeon" <nobody@nowhere .com> wrote in message
      news:k2mxc.2772 9$sS2.851699@ne ws20.bellglobal .com...[color=blue]
      > Here is my solution. Air coded...
      >
      > -----------------
      > Public Function getLetterGrade( Byval Grade AS Double) As String
      > getLetterGrade = Nz(DLookup("Let ter_Grade", "GPA", "GPA = " &
      > DMax("GPA", "GPA", "GPA <= 2.43")))
      > End Function
      > -----------------
      >
      > HTH
      >
      > Yannick
      >
      > "Paul Mendez" <pmendez@thelyn dco.com> wrote in message
      > news:99915b66.0 406080700.7d438 9a@posting.goog le.com...[color=green]
      > > How can look up a value in access if I have a table (GPA) with all the
      > > endpoints. Below, is the exact table. For example, if someones grade
      > > averaged to a 2.43, since the 2.43 lies within the 2.33-2.67 interval,
      > > then the letter grade would be a B-. Please help!!!!
      > >
      > > GPA Letter_Grade
      > > 0 F
      > > 0.33 D-
      > > 0.67 D
      > > 1 D+
      > > 1.33 C-
      > > 1.67 C
      > > 2 C+
      > > 2.33 B-
      > > 2.67 B
      > > 3 B+
      > > 3.33 A-
      > > 3.67 A
      > > 4 A+
      > > I understand I could us an if statement of some sort but there are too
      > > many intervals.
      > >
      > > Thanks[/color]
      >
      >[/color]


      Comment

      • Alan Webb

        #4
        Re: Looking up values

        Paul,
        Given:
        StudentAssignme nt.Grade and GradeScale.MinV alue, GradeScale,MaxV alue,
        GradeScale.Lett erGrade, then:

        "SELECT STUDENT_ASSIGNM ENT.GRADE, GRADE_SCALE.LET TER_GRADE
        FROM STUDENT_ASSIGNM ENT, LETTER_GRADE
        WHERE STUDENT_ASSIGNM ENT.GRADE >= GRADE_SCALE.MIN _VALUE
        AND STUDENT_ASSIGNM ENT.GRADE <= GRADE_SCALE.MAX _VALUE;"

        It's not the usual inner, outer join on an equals sign, but it will work.

        "Paul Mendez" <pmendez@thelyn dco.com> wrote in message
        news:99915b66.0 406080700.7d438 9a@posting.goog le.com...[color=blue]
        > How can look up a value in access if I have a table (GPA) with all the
        > endpoints. Below, is the exact table. For example, if someones grade
        > averaged to a 2.43, since the 2.43 lies within the 2.33-2.67 interval,
        > then the letter grade would be a B-. Please help!!!!
        >
        > GPA Letter_Grade
        > 0 F
        > 0.33 D-
        > 0.67 D
        > 1 D+
        > 1.33 C-
        > 1.67 C
        > 2 C+
        > 2.33 B-
        > 2.67 B
        > 3 B+
        > 3.33 A-
        > 3.67 A
        > 4 A+
        > I understand I could us an if statement of some sort but there are too
        > many intervals.
        >
        > Thanks[/color]


        Comment

        • James Fortune

          #5
          Re: Looking up values

          pmendez@thelynd co.com (Paul Mendez) wrote in message news:<99915b66. 0406080700.7d43 89a@posting.goo gle.com>...[color=blue]
          > How can look up a value in access if I have a table (GPA) with all the
          > endpoints. Below, is the exact table. For example, if someones grade
          > averaged to a 2.43, since the 2.43 lies within the 2.33-2.67 interval,
          > then the letter grade would be a B-. Please help!!!!
          >
          > GPA Letter_Grade
          > 0 F
          > 0.33 D-
          > 0.67 D
          > 1 D+
          > 1.33 C-
          > 1.67 C
          > 2 C+
          > 2.33 B-
          > 2.67 B
          > 3 B+
          > 3.33 A-
          > 3.67 A
          > 4 A+
          > I understand I could us an if statement of some sort but there are too
          > many intervals.
          >
          > Thanks[/color]

          How about trying to use separate functions for GradeLetter and
          GradeSign? The GradeLetter function would only have to check five
          ranges. The GradeSign would only have to check three decimal fraction
          ranges once the special case of 0.0 is handled.

          James A. Fortune

          Comment

          • Alan Webb

            #6
            Re: Looking up values

            Paul wrote this to me in a personal e-mail. It is repeated here to maintain
            the integrity of the thread.

            Thank you for the reply, but where do I write that SQL code? I don't know
            too much about SQL. Once again, thanks

            And I replied:

            It's bad form to reply to newsgroup stuff outside the newsgroup, so I posted
            your reply there. But . . . you would create a query and type the query into
            the SQL view of the query. And . . . Learn SQL--it will save you hours of
            frustrating time writing functions that iterate through arrays and
            manipulate them. Let the db engine do the work.


            Comment

            Working...