IIf statement query?

mesci

Registered User.
Local time
Today, 19:41
Joined
Jul 24, 2002
Messages
27
Hi!,

I have two different types of marking schemes for students in my database.

However I want to show only 1 final mark field (Pass/Fail) for use in report pull ups and pie charts (showing % of fails and Passes)

I have a combo box from which the user needs to select which marking scheme the student was marked on:

Pre 2002 Grading System % or 2002 Grading System (A-E)

are the two choices.

I want to be able to say that if Pre 2002 Grading System is selected then look at the Pre 2002 Grading final mark - if this has a mark then show 'Pass' if it is Null show 'Fail'

I also want to say the same for the 2002 Grading System (A-E) to say that if this is selected then look at the 2002 Grading final mark - if it has a mark then show 'Pass' if it is null show 'Fail'

How do I go about coding this?

My fields are as follows:

For choice of grading systems - field = [Grading System Used]

For old grading system final mark field = [OSFinal Mark Awarded]

For new grading system final mark field = [FinalMark]

If anyone could help I'd appreciate it!!!!

Cheers!!!
 
select case.

Perhaps you can use a select case phrase?

(you will have to check the syntax, I´m not that used to this...)


select case grading system used

case Pre 2002 Grading System %
if ..... then ....

case 2002 Grading System (A-E)
if ... then ...


Fuga.
 
Thanks Fuga...but?

Cheers for pointing me in that direction Fuga....I have attempted to put a Select Case Phrase in my coding under the text box, but it isn't working.

This is the code which I have put in:

Private Sub Final_Result_Awarded_All_Systems_BeforeUpdate(Cancel As Integer)
Select Case Grading_System_Used
Case "Pre 2002 Grading System %"
If ([OSFinal Mark Awarded] >= 50) Then Me = "Pass"
Case "Pre 2002 Grading System %"
If ([OSFinal Mark Awarded] < 50) Then Me = "Fail"
Case "2002 Grading System (A-E)"
If ([Final Mark] >= 15) Then Me = "Pass"
Case "2002 Grading System (A-E)"
If ([Final Mark] < 15) Then Me = "Fail"
Case Else
Me = ""
End If
End Sub

If anyone can point out where I'm going wrong it would be much appreciated!!!!

Thanx!
 
Mesci,
I don't uynderstand why you have chosen to create two Cases for the same conditions:

Case "Pre 2002 Grading System %"
If ([OSFinal Mark Awarded] >= 50) Then Me = "Pass"
Case "Pre 2002 Grading System %"
If ([OSFinal Mark Awarded] < 50) Then Me = "Fail"
Case "2002 Grading System (A-E)"
If ([Final Mark] >= 15) Then Me = "Pass"
Case "2002 Grading System (A-E)"
If ([Final Mark] < 15) Then Me = "Fail"
Case Else
Me = ""


I don't think that is proper...although..'m often wrong:rolleyes:

I would suggest:

Case "Pre 2002 Grading System %"
If ([OSFinal Mark Awarded] >= 50) Then Me = "Pass"
Else
If ([OSFinal Mark Awarded] < 50) Then Me = "Fail"
Else
Me.[ControlBox] = ""
End If

Case "2002 Grading System (A-E)"
If ([Final Mark] >= 15) Then Me = "Pass"
Else
If ([Final Mark] < 15) Then Me = "Fail"
Else
Me.[ControlBox] = ""
End If
End Sub
 
It still isn't working

Cheers for your help Adrianna, I tried putting this in but it keeps coming up with the following statement:

Compile Error
Else without If

I think I'm going to have to go back to the drawing board and look at the structure of my database to see if there is another way to do this - unless you (or anyone else) have any other ideas on the matter?
 
Did you remove the Case Else that you had at the end of your code?

A simple Else without If is worth debugging...usually it's something very simple that may have been looked over.
 
yep....

I just copied and pasted your code in - and changed the [ControlBox] to the actual field name...and then I tried it as a straight copy and paste.....
 
Hehe...I wasn't paying attention. I guess these pain killers are working well. I forgot to End If the nested If statements. Try doing that! I bet your worries will be over!!
 
Cheers Adrianna

I tried putting in the end if's but it still isn't working....however I have sorted out the problem in a different way...

I put in two unbound text boxes which said (if grades over 50 then pass if not fail etc etc)

and then in the controlbox I put an Iff statement - with regards to the type of marking scheme chosen show the specific text box value...

It's working...so I'm happy...for now...

Thankyou anyway for all your help....

:D
 

Users who are viewing this thread

Back
Top Bottom