Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto fill a field based on seperate field 1

Status
Not open for further replies.

madrappin

Technical User
Mar 16, 2004
68
US
I am trying to find a way to automatically show the grade if the score is entered.

So the fields name is SCORE and say if it is a number 0-24 it a field named GRADE will say "Fail" and 25-35 will say "D", so on and so forth. Any help would be appreciated. Thanks.
 
How about...
Select Case Score
Case <25:
Grade = "Fail"
Case <36:
Grade = "D"
Case <50:
Grade = "C"
Case Else:
Grade = "Pass"
End Select


Randy
 
What is Case? I am a little confused by that whole statement. If you could please explain more. Thanks.
 
The Select Case statement evaluates the expression (in this case Score) and executes the first case that satisfies the expression. For example... say Score = 29. The first case (<25) fails because 29 is not less than 25. The second case (<36) passes because 29 IS less than 36. So the command Grade = "D" is executed and the code jumps to the End Select.


Randy
 
Can I use that statement as a subquery or do I set it up as a query by itself?
 
In design view of your form, select the text box that you plan to type the score in. Right click to bring up the properties window. Select the event tab. Select the After Update event. Click on the box to the right containing three dots. Select code builder. This will bring up the code window and you should see something like this....
Private Sub Something_AfterUpdate()

End Sub


Put the code between those two lines. Go back to the form, switch to form view, and enter a number in text box.


Randy
 
Thanks! That worked perfectly thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top