SparkyP
asked on
No Data Subform
I have a Dashboard/Switchboard Form that has a unbound subform, based on a query that looks at a score from an Answers Table.
On the Dashboard Form I have an unbound textbox "Text38" which displays text based on the results of the percentage field in the subform, using the following code on the On Current Event:
If IsNull(Me!mjpMaxScore!Perc entage) Then
Me!Text38.Visible = False
ElseIf Me!mjpMaxScore!Percentage >= 85 Then
Me!Text38 = "World Class"
ElseIf Me!mjpMaxScore!Percentage < 85 And Me!mjpMaxScore!Percentage >= 70 Then
Me!Text38 = "Good Operational Standard"
ElseIf Me!mjpMaxScore!Percentage < 70 And Me!mjpMaxScore!Percentage >= 40 Then
Me!Text38 = "Acceptable - Further Action Required"
ElseIf Me!mjpMaxScore!Percentage < 40 And Me!mjpMaxScore!Percentage > 0 Then
Me!Text38 = "Poor - Immediate Action Required"
ElseIf Me!mjpMaxScore!Percentage = 0 Then
Me!Text38 = "No Questions Answered or All Major N/C"
End IF
This works perfectly when there is data, but throws up "Runtime Error 2427 -you have entered an invalid expression that has no value"
How do I deal with this, please?
Thanks in anticipation.
On the Dashboard Form I have an unbound textbox "Text38" which displays text based on the results of the percentage field in the subform, using the following code on the On Current Event:
If IsNull(Me!mjpMaxScore!Perc
Me!Text38.Visible = False
ElseIf Me!mjpMaxScore!Percentage >= 85 Then
Me!Text38 = "World Class"
ElseIf Me!mjpMaxScore!Percentage < 85 And Me!mjpMaxScore!Percentage >= 70 Then
Me!Text38 = "Good Operational Standard"
ElseIf Me!mjpMaxScore!Percentage < 70 And Me!mjpMaxScore!Percentage >= 40 Then
Me!Text38 = "Acceptable - Further Action Required"
ElseIf Me!mjpMaxScore!Percentage < 40 And Me!mjpMaxScore!Percentage > 0 Then
Me!Text38 = "Poor - Immediate Action Required"
ElseIf Me!mjpMaxScore!Percentage = 0 Then
Me!Text38 = "No Questions Answered or All Major N/C"
End IF
This works perfectly when there is data, but throws up "Runtime Error 2427 -you have entered an invalid expression that has no value"
How do I deal with this, please?
Thanks in anticipation.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
So, is this code in the Current event of the subform?
Jim, like that AvoidError function, why didn't I ever think of that? So, to avoid a divide by zero error, you would do something like?
Percentage: AvoidError([SomeField]/[So meOtherFie ld], 99)
Jim, like that AvoidError function, why didn't I ever think of that? So, to avoid a divide by zero error, you would do something like?
Percentage: AvoidError([SomeField]/[So
ASKER
Dale
On Current in the Main Form
On Current in the Main Form
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Both
Works like a dream
Works like a dream
ASKER
The Calc is from a Query which has several Calcs that display in the subform, ie. Sum of questions, sum of question answered etc.
Obviously if no questions have been asked or answered the query has no results.
The percentage calc is the one that is used to display the text.
Sorry for any confusion.