Solved multiple values from the query to the function

FahadTiger

Member
Local time
Today, 12:48
Joined
Jun 20, 2021
Messages
120
Hi everyone..
I have a query to display students' scores..and there are 8 subjects..such as mathematics, physics, chemistry, etc..each subject is in a field
In case that the student obtained a grade between 20 and 24 in mathematics, we write in the field (pass)
In case that he obtained a score between 24 and 30 in physics, we write in the field (pass)
I made a function to pass the math value..and everything is fine
Does this mean that I need 8 functions to pass the values of the rest of the subjects?
Any advice
-----------------
Function CheckDegree(sMath As Double) As String

If sMath > 20 And sMath < 24 Then
CheckDegree = "pass"
Else
CheckDegree = ""
End If
End Function
and in query I put this..
CheckDegree(Math)
 
Yes, unless you construct your database correctly.
Look up 'normalization'

Each score should be a record with an extra field to indicate which subject.

You could at a push make it generic for every subject, but what if the pass levels are different?
 
see table, SubjectsT, there is Lo/High scores.
now see Query1.
there is no need for a function.
 

Attachments

thanks Gasman for replying
There are some subjects in which passing scores are different
This means that I make one module for similar subjects in passing scores
And do other functions for the different
Yes, unless you construct your database correctly.
Look up 'normalization'

Each score should be a record with an extra field to indicate which subject.

You could at a push make it generic for every subject, but what if the pass levels are different?
 
added XTab table, then use Query1 and Xtab table to create crosstab query (Crosstab).
 

Attachments

added XTab table, then use Query1 and Xtab table to create crosstab query (Crosstab).
yes.. that what I want
thanks arnelgp
You did a good job for me..and I thank you very much
How do I hide the empty fields?
1680545185913.png
 
Last edited:
thanks Gasman for replying
There are some subjects in which passing scores are different
This means that I make one module for similar subjects in passing scores
And do other functions for the different
So I would use a table with a record for each subject and min and max grades for pass, etc.
 

Users who are viewing this thread

Back
Top Bottom