Edit conditional statements in vba via form.

matiyas

Registered User.
Local time
Today, 03:42
Joined
May 6, 2013
Messages
24
this is what i want to achieve.
I have a table of marks of student, a query that calculates totals and a form that displays results.
on the query, i have an if statement.

Code:
comment:IIf([Marks]>=80,"good",IIf([Marks]>=50,"fair",IIf([Marks]>=40,"Work harder")))

So i want to be able to make the whole syntax available for user to edit without
actually doing it in vba.
is this possible in vba? i would really appreciate your help.
i have attached an image that will help you understand exactly what i mean.

attachment.php
 

Attachments

Last edited:
When you want to give users control over things like this, let them update a table. then your query can join to the table and pull up the name based on the value.
 
i did that but it gives wrong results, instead of using the table (comments) to determine the correct results it gives results of the comments table instead.
in the query i used the following formula.
Note:
Marks- is the students marks. (tbl Marks)
Marks1-marks to be compared to. (tbl Comments)
Comment-is the comment in regard to the marks by students in (tbl Comments)

Code:
comment: IIf([Marks]>=([Comments.Marks1]),([Comments.Comment]),IIf([Marks]>=([Comments.Marks1]),([Comments.Comment]),IIf([Marks]>=([Comments.Marks1]),([Comments.Comment]))))
 
Last edited:
Is there any logical reason you are checking the same condition three times? Your last If does not have a False part.. That will throw an ERROR..
 
i hope this helps you get what i mean.

2QSbf0
 
Last edited:
it seems to be confusing more and more. just forget it, thanks anyway.
 
Found solution. using the following simple SQL Statement in a Query.
No VBA.
Code:
SELECT SM.Student_ID, SM.Students, SM.Marks, GD.Grade
FROM tblStudentMarks AS SM, tblGradeDenormalized AS GD;

i have attached database for any one who might need it.:cool:
 

Attachments

Users who are viewing this thread

Back
Top Bottom