CASE Statement in access 2003 with Attachment

sichilaba

New member
Local time
Today, 17:03
Joined
Jan 8, 2011
Messages
6
Hi

Find attacment of the CASE Statement on the attached database in Access 2003. Name of the database is Kent.

I have typed the code below in the StudentResult text box but it is not working. Please check out the attachment and help

Private Sub StudentResult_afterupdate ()
Dim StudentMark As Integer
Dim StudentResult As String

Select Case StudentMark.value
Case Is > 50
StudentResult = "Fail"
Case 51 To 60
StudentResult = "Pass"
Case 61 To 70
StudentResult = "Credit"
Case 71 To 80
StudentResult = "Merit"
Case 81 To 90
StudentResult = "Distinction"
End Select
End Sub
 

Attachments

Why start a new thread when this post appears in the original and I have replied to it?

Brian
 
You are duplicating your threads. This is not permitted.

Also you are cancelling out your mark value by dimming a variable of th same name
Private Sub StudentResult_afterupdate ()

Code:
Select Case Me.StudentMark
Case Is [COLOR="DarkRed"][B]< [/B][/COLOR]50
Me.StudentResult = "Fail"
Case 51 To 60
Me.StudentResult = "Pass"
Case 61 To 70
Me.StudentResult = "Credit"
Case 71 To 80
Me.StudentResult = "Merit"
Case 81 To 90
Me.StudentResult = "Distinction"
Case else
Me.StudentMark = "Not known"
End Select
End Sub
 
Thanks David. At least lam almost getting there....The first record displays the answer correctly but subsequent records displays nothing. How do l fix this?
 

Users who are viewing this thread

Back
Top Bottom