#Size! Error

GT_engineer

Registered User.
Local time
Today, 06:44
Joined
Aug 23, 2012
Messages
85
I have a field in my report its name is PreText and its control source is set to a function, =PreTotal()

where
Code:
Private Function PreTotal()
    Risk = 0
    If Me.PreRisk_minor = -1 Then Risk = 1
    If Me.PreRisk_mod = -1 Then Risk = 2
    If Me.PreRisk_Serious = -1 Then Risk = 4
    If Me.PreRisk_major = -1 Then Risk = 6
    If Me.PreRisk_disaster = -1 Then Risk = 8
    If Me.PreRisk_catastrophic = -1 Then Risk = 10
    Recur = 0
    If Me.PreRecur_min = -1 Then Recur = 1
    If Me.PreRecur_Infreq = -1 Then Recur = 2
    If Me.PreRecur_mod = -1 Then Recur = 3
    If Me.PreRecur_Freq = -1 Then Recur = 4
    If Me.PreRecur_Cont = -1 Then Recur = 5
    Expose = 0
    If Me.PreTime_infreq = -1 Then Expose = 1
    If Me.PreTime_mod = -1 Then Expose = 2
    If Me.PreTime_often = -1 Then Expose = 3
    If Me.Pretime_Freq = -1 Then Expose = 4
    PreTotal = Risk + Recur + Expose
    
    If PreTotal <= 6 Then Me.PreText = "Low"
    If PreTotal >= 7 And PreTotal <= 10 Then Me.PreText = "Moderate"
    If PreTotal >= 11 And PreTotal <= 15 Then Me.PreText = "HIGH"
    If PreTotal >= 16 Then Me.PreText = "SEVERE!"
        
End Function

I keep getting a #Size! error in the field. I stepped through the code, in my sample case PreTotal adds up to 16 so I should see "SEVERE!" as my answer.

Any ideas what a #size! error is???
 
You don't want to set the value of the textbox, you want to set the return value of the function.
 
Of course, it works now!

Thanks for the help
 
Last edited:

Users who are viewing this thread

Back
Top Bottom