Question:
Can an if…else command be inserted into a report’s internal script? Depending on the condition’s result, a Label object’s Text property will be edited.
Solution:
To compare a certain data field from the report, which will receive numeric data, you must use Val function, which will return the data field’s value converted into number format. Example:
- Sub PageFooter_BeforePrint
- Me.FieldMult.Text = Val(Me.fieldAvg.Text * 0.8)
- if ((Val(Me.fieldAvg.Text * 0.8)) >= Val(Me.fieldMax.Text)) then
- Me.LabelResult.Text = "Approved"
- else
- Me.LabelResult.Text = "Reproved"
- end if
- End Sub
NOTE: The sample application attached to this article was developed with E3 version 6.6 Build 292.