2

I would like to create a column that displays if a student has passed or failed. To pass the overall grade needs to be above 40.

I have done this before using access using the following:

IIf([Overall]<=40,"fail","pass")

But I’m very new to visual basic. Anyone got any ideas on how I can do this?

The IDE I am using is Visual Studio

This is the table

enter image description here

Or if there are any tutorials that you would recommend that would be great.

1 Answer 1

3

You can do it in your table definition:

  • You can use a CASE WHEN statement to check for a criteria and provide a value.
  • You can not refer to a computed column in another computed column.

So you can add a column like this:

[ColumnName] AS CASE WHEN (the formula for overall) <= 40 THEN 'fail' ELSE 'pass' END

Also you can make the result as a bit (boolean) data type and let the application decide to show a string instead of true or false.

Sign up to request clarification or add additional context in comments.

1 Comment

ahhh right I see thank you my good man, and also thank you Reza for the idea of making the result a bit data type, then I can refer to the true or false result differently throughout my forms if needed instead of using just pass or fail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.