1. ## If...then (2000-2002)

How do I make Access put in information depending on the criteria? For instance, if someone scores a 90 to 100 I want to put an "A" in the box, if 80 to 89 a "B" in the box and so on.

2. ## Re: If...then (2000-2002)

... I am assuming that you do not plan on coding in Visual Basic. Within the Field of the query, you could do a multi level If then statement such as below:

IIf([FIELD1]>=90,"A",IIf([FIELD1]>=80,"B",IIf([FIELD1]>=70,"C","D")))

3. ## Re: If...then (2000-2002)

You could use the Switch function:

: Switch([score] Between 90 And 100,"A",[score] Between 80 And 89,"B",---and the rest---)

4. ## Re: If...then (2000-2002)

Okay, let see how many ways there are in Access to solve this problem...

You could use something like:

<font face="Georgia">Choose(11 - Int([score] / 10), "A", "A", "B", "C", "D", "F", "F", "F", "F", "F", "F")</font face=georgia>

5. ## Re: If...then (2000-2002)

You didn't explain *where* you wanted to do this and what "box" you were talking about. Are you trying to display the grade on a form or report, show it in a query, or insert it into a table?

6. ## Re: If...then (2000-2002)

Put the following function in a module and modify it to suit.

For example you could change:

Case 5 To 10
fMark = "d) Between 5% and 10%"

To:

Case 5 To 10
fMark = "A"

You need to keep the text between the

7. ## Re: If...then (2000-2002)

... May I just say that this is a slick way to do this...

8. ## Re: If...then (2000-2002)

Charlotte,
Thanks for replying. What I want to do is put the grade info in a box in a form or report. So I guess I want to link the box to the grade field in a table, but instead of displaying an number, I want the box to display a letter grade. Hope this makes it a bit more clear.

9. ## Re: If...then (2000-2002)

In that case, one of the suggestions using built in functions like Choose or Switch can be used in the underlying query to generate a grade letter on the fly for your form or report. That does two things for you: it displays the grade but will not allow it to be edited, and it keeps you from having to store a letter grade in a table, since it can be generated whenever you need to display it.

#### Posting Permissions

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